diff mbox series

[v1,5/9] iio: accel: st_accel: Mark default_accel_pdata with __maybe_unused

Message ID 20191216173853.75797-5-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/9] iio: light: st_uvis25: Drop unneeded header inclusion | expand

Commit Message

Andy Shevchenko Dec. 16, 2019, 5:38 p.m. UTC
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 default_accel_pdata with __maybe_unused to calm a compiler down:

In file included from drivers/iio/accel/st_accel_i2c.c:19:
drivers/iio/accel/st_accel.h:67:46: warning: ‘default_accel_pdata’ defined but not used [-Wunused-const-variable=]
   67 | static const struct st_sensors_platform_data default_accel_pdata = {
      |                                              ^~~~~~~~~~~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/st_accel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Dec. 23, 2019, 4:20 p.m. UTC | #1
On Mon, 16 Dec 2019 19:38:49 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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 default_accel_pdata with __maybe_unused to calm a compiler down:
> 
> In file included from drivers/iio/accel/st_accel_i2c.c:19:
> drivers/iio/accel/st_accel.h:67:46: warning: ‘default_accel_pdata’ defined but not used [-Wunused-const-variable=]
>    67 | static const struct st_sensors_platform_data default_accel_pdata = {
>       |                                              ^~~~~~~~~~~~~~~~~~~
> ...
Applied.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/accel/st_accel.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index af09943f38c9..5b13e293cade 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -64,7 +64,7 @@ enum st_accel_type {
>  * struct st_sensors_platform_data - default accel platform data
>  * @drdy_int_pin: default accel DRDY is available on INT1 pin.
>  */
> -static const struct st_sensors_platform_data default_accel_pdata = {
> +static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = {
>  	.drdy_int_pin = 1,
>  };
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index af09943f38c9..5b13e293cade 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -64,7 +64,7 @@  enum st_accel_type {
 * struct st_sensors_platform_data - default accel platform data
 * @drdy_int_pin: default accel DRDY is available on INT1 pin.
 */
-static const struct st_sensors_platform_data default_accel_pdata = {
+static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = {
 	.drdy_int_pin = 1,
 };