linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: tsl2583: fix unused function warning
@ 2016-11-08 14:01 Arnd Bergmann
  2016-11-08 20:27 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-11-08 14:01 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Arnd Bergmann, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, Brian Masney,
	Eva Rachel Retuya, Bhumika Goyal, linux-iio, devel, linux-kernel

Removing a call to the taos_chip_off() makes it unused when CONFIG_PM
is disabled:

drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function]

This removes all the #ifdef in this file, and marks the PM functions as
__maybe_unused instead, which is more reliable and gives us better
compile time coverage.

Fixes: 0561155f6fc5 ("staging: iio: tsl2583: don't shutdown chip when updating the lux table")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/iio/light/tsl2583.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
index 7eab17f4557e..d74e33bacbf9 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -816,8 +816,7 @@ static int taos_probe(struct i2c_client *clientp,
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int taos_suspend(struct device *dev)
+static int __maybe_unused taos_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
@@ -834,7 +833,7 @@ static int taos_suspend(struct device *dev)
 	return ret;
 }
 
-static int taos_resume(struct device *dev)
+static int __maybe_unused taos_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
@@ -850,10 +849,6 @@ static int taos_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume);
-#define TAOS_PM_OPS (&taos_pm_ops)
-#else
-#define TAOS_PM_OPS NULL
-#endif
 
 static struct i2c_device_id taos_idtable[] = {
 	{ "tsl2580", 0 },
@@ -863,7 +858,6 @@ static struct i2c_device_id taos_idtable[] = {
 };
 MODULE_DEVICE_TABLE(i2c, taos_idtable);
 
-#ifdef CONFIG_OF
 static const struct of_device_id taos2583_of_match[] = {
 	{ .compatible = "amstaos,tsl2580", },
 	{ .compatible = "amstaos,tsl2581", },
@@ -871,15 +865,12 @@ static const struct of_device_id taos2583_of_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(of, taos2583_of_match);
-#else
-#define taos2583_of_match NULL
-#endif
 
 /* Driver definition */
 static struct i2c_driver taos_driver = {
 	.driver = {
 		.name = "tsl2583",
-		.pm = TAOS_PM_OPS,
+		.pm = &taos_pm_ops,
 		.of_match_table = taos2583_of_match,
 	},
 	.id_table = taos_idtable,
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: iio: tsl2583: fix unused function warning
  2016-11-08 14:01 [PATCH] staging: iio: tsl2583: fix unused function warning Arnd Bergmann
@ 2016-11-08 20:27 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-11-08 20:27 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, Brian Masney, Eva Rachel Retuya,
	Bhumika Goyal, linux-iio, devel, linux-kernel

On 08/11/16 14:01, Arnd Bergmann wrote:
> Removing a call to the taos_chip_off() makes it unused when CONFIG_PM
> is disabled:
> 
> drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function]
> 
> This removes all the #ifdef in this file, and marks the PM functions as
> __maybe_unused instead, which is more reliable and gives us better
> compile time coverage.
> 
> Fixes: 0561155f6fc5 ("staging: iio: tsl2583: don't shutdown chip when updating the lux table")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 7eab17f4557e..d74e33bacbf9 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -816,8 +816,7 @@ static int taos_probe(struct i2c_client *clientp,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int taos_suspend(struct device *dev)
> +static int __maybe_unused taos_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -834,7 +833,7 @@ static int taos_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -static int taos_resume(struct device *dev)
> +static int __maybe_unused taos_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -850,10 +849,6 @@ static int taos_resume(struct device *dev)
>  }
>  
>  static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume);
> -#define TAOS_PM_OPS (&taos_pm_ops)
> -#else
> -#define TAOS_PM_OPS NULL
> -#endif
>  
>  static struct i2c_device_id taos_idtable[] = {
>  	{ "tsl2580", 0 },
> @@ -863,7 +858,6 @@ static struct i2c_device_id taos_idtable[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, taos_idtable);
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id taos2583_of_match[] = {
>  	{ .compatible = "amstaos,tsl2580", },
>  	{ .compatible = "amstaos,tsl2581", },
> @@ -871,15 +865,12 @@ static const struct of_device_id taos2583_of_match[] = {
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, taos2583_of_match);
> -#else
> -#define taos2583_of_match NULL
> -#endif
>  
>  /* Driver definition */
>  static struct i2c_driver taos_driver = {
>  	.driver = {
>  		.name = "tsl2583",
> -		.pm = TAOS_PM_OPS,
> +		.pm = &taos_pm_ops,
>  		.of_match_table = taos2583_of_match,
>  	},
>  	.id_table = taos_idtable,
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-08 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 14:01 [PATCH] staging: iio: tsl2583: fix unused function warning Arnd Bergmann
2016-11-08 20:27 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).