diff mbox series

[20/36] iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220621202719.13644-21-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: switch easy cases to new simpler PM related macros. | expand

Commit Message

Jonathan Cameron June 21, 2022, 8:27 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: David Heidelberg <david@ixit.cz>
---
 drivers/iio/light/al3320a.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron June 25, 2022, 1:06 p.m. UTC | #1
On Tue, 21 Jun 2022 21:27:03 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: David Heidelberg <david@ixit.cz>
I'll just copy this here from reply to patch 19 so b4 will do
everything automatically for me. 

both patches 19 and 20:

Reviewed-by: David Heidelberg <david@ixit.cz>

> ---
>  drivers/iio/light/al3320a.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
> index cc1407ccc10a..bc99179728ed 100644
> --- a/drivers/iio/light/al3320a.c
> +++ b/drivers/iio/light/al3320a.c
> @@ -223,17 +223,18 @@ static int al3320a_probe(struct i2c_client *client,
>  	return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
> -static int __maybe_unused al3320a_suspend(struct device *dev)
> +static int al3320a_suspend(struct device *dev)
>  {
>  	return al3320a_set_pwr(to_i2c_client(dev), false);
>  }
>  
> -static int __maybe_unused al3320a_resume(struct device *dev)
> +static int al3320a_resume(struct device *dev)
>  {
>  	return al3320a_set_pwr(to_i2c_client(dev), true);
>  }
>  
> -static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend,
> +				al3320a_resume);
>  
>  static const struct i2c_device_id al3320a_id[] = {
>  	{"al3320a", 0},
> @@ -251,7 +252,7 @@ static struct i2c_driver al3320a_driver = {
>  	.driver = {
>  		.name = AL3320A_DRV_NAME,
>  		.of_match_table = al3320a_of_match,
> -		.pm = &al3320a_pm_ops,
> +		.pm = pm_sleep_ptr(&al3320a_pm_ops),
>  	},
>  	.probe		= al3320a_probe,
>  	.id_table	= al3320a_id,
diff mbox series

Patch

diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
index cc1407ccc10a..bc99179728ed 100644
--- a/drivers/iio/light/al3320a.c
+++ b/drivers/iio/light/al3320a.c
@@ -223,17 +223,18 @@  static int al3320a_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-static int __maybe_unused al3320a_suspend(struct device *dev)
+static int al3320a_suspend(struct device *dev)
 {
 	return al3320a_set_pwr(to_i2c_client(dev), false);
 }
 
-static int __maybe_unused al3320a_resume(struct device *dev)
+static int al3320a_resume(struct device *dev)
 {
 	return al3320a_set_pwr(to_i2c_client(dev), true);
 }
 
-static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend,
+				al3320a_resume);
 
 static const struct i2c_device_id al3320a_id[] = {
 	{"al3320a", 0},
@@ -251,7 +252,7 @@  static struct i2c_driver al3320a_driver = {
 	.driver = {
 		.name = AL3320A_DRV_NAME,
 		.of_match_table = al3320a_of_match,
-		.pm = &al3320a_pm_ops,
+		.pm = pm_sleep_ptr(&al3320a_pm_ops),
 	},
 	.probe		= al3320a_probe,
 	.id_table	= al3320a_id,