]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: core: switch info_mask fields to unsigned long to match find_bit helpers
authorJunjie Cao <junjie.cao@intel.com>
Wed, 20 Aug 2025 00:47:55 +0000 (08:47 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 25 Aug 2025 10:07:17 +0000 (11:07 +0100)
for_each_set_bit()/find_*_bit() expect arrays of unsigned long (see
include/linux/find.h), but industrialio-core passed const long * into
iio_device_add_info_mask_type{,_avail}().

These masks are used purely as bit arrays and are populated via BIT()
(1UL << n). Switch the info_mask_* fields and the corresponding function
parameters to unsigned long so the types match the helpers. This removes
sparse warnings about signedness mismatches (seen with 'make C=1'
CF='-Wsparse-all') without changing behavior or struct layout.

No functional change intended.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/20250820004755.69627-1-junjie.cao@intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c
include/linux/iio/iio.h

index eb6a54f8115dec54d284d091e35696744764ac05..38848d753a33de045d4b4832fae88aca9519414b 100644 (file)
@@ -1244,7 +1244,7 @@ static int iio_device_add_channel_label(struct iio_dev *indio_dev,
 static int iio_device_add_info_mask_type(struct iio_dev *indio_dev,
                                         struct iio_chan_spec const *chan,
                                         enum iio_shared_by shared_by,
-                                        const long *infomask)
+                                        const unsigned long *infomask)
 {
        struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
        int i, ret, attrcount = 0;
@@ -1274,7 +1274,7 @@ static int iio_device_add_info_mask_type(struct iio_dev *indio_dev,
 static int iio_device_add_info_mask_type_avail(struct iio_dev *indio_dev,
                                               struct iio_chan_spec const *chan,
                                               enum iio_shared_by shared_by,
-                                              const long *infomask)
+                                              const unsigned long *infomask)
 {
        struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
        int i, ret, attrcount = 0;
index 2f5560646ee49052deaaaae1dd2b92b21c4d4fd5..872ebdf0dd77a1a1631dff63865613ac42144b46 100644 (file)
@@ -271,14 +271,14 @@ struct iio_chan_spec {
                        unsigned int num_ext_scan_type;
                };
        };
-       long                    info_mask_separate;
-       long                    info_mask_separate_available;
-       long                    info_mask_shared_by_type;
-       long                    info_mask_shared_by_type_available;
-       long                    info_mask_shared_by_dir;
-       long                    info_mask_shared_by_dir_available;
-       long                    info_mask_shared_by_all;
-       long                    info_mask_shared_by_all_available;
+       unsigned long                   info_mask_separate;
+       unsigned long                   info_mask_separate_available;
+       unsigned long                   info_mask_shared_by_type;
+       unsigned long                   info_mask_shared_by_type_available;
+       unsigned long                   info_mask_shared_by_dir;
+       unsigned long                   info_mask_shared_by_dir_available;
+       unsigned long                   info_mask_shared_by_all;
+       unsigned long                   info_mask_shared_by_all_available;
        const struct iio_event_spec *event_spec;
        unsigned int            num_event_specs;
        const struct iio_chan_spec_ext_info *ext_info;