]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: st_lsm6dsx: Mark predefined constants with __maybe_unused
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 16 Dec 2019 18:19:23 +0000 (20:19 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 29 Dec 2019 15:20:03 +0000 (15:20 +0000)
Since we put static variable to a header file it's copied to each module
that includes the header. But not all of them are actually used it.

Mark predefined constants with __maybe_unused to calm a compiler down:

In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c:17:
.../st_lsm6dsx/st_lsm6dsx.h:399:28: warning: ‘st_lsm6dsx_available_scan_masks’ defined but not used [-Wunused-const-variable=]
  399 | static const unsigned long st_lsm6dsx_available_scan_masks[] = {0x7, 0x0};
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../st_lsm6dsx/st_lsm6dsx.h:392:36: warning: ‘st_lsm6dsx_event’ defined but not used [-Wunused-const-variable=]
  392 | static const struct iio_event_spec st_lsm6dsx_event = {
      |                                    ^~~~~~~~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h

index c605b153be410af4f4ad8fc4fd1aee17838989ed..f1189eef6e372c1947d54cb46349c08d1558511d 100644 (file)
@@ -391,14 +391,17 @@ struct st_lsm6dsx_hw {
        const struct st_lsm6dsx_settings *settings;
 };
 
-static const struct iio_event_spec st_lsm6dsx_event = {
+static __maybe_unused const struct iio_event_spec st_lsm6dsx_event = {
        .type = IIO_EV_TYPE_THRESH,
        .dir = IIO_EV_DIR_EITHER,
        .mask_separate = BIT(IIO_EV_INFO_VALUE) |
                         BIT(IIO_EV_INFO_ENABLE)
 };
 
-static const unsigned long st_lsm6dsx_available_scan_masks[] = {0x7, 0x0};
+static __maybe_unused const unsigned long st_lsm6dsx_available_scan_masks[] = {
+       0x7, 0x0,
+};
+
 extern const struct dev_pm_ops st_lsm6dsx_pm_ops;
 
 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,