diff mbox series

[14/36] iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220621202719.13644-15-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:26 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: Philippe Reynes <tremyfr@yahoo.fr>
---
 drivers/iio/dac/max5821.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron June 25, 2022, 1:07 p.m. UTC | #1
On Thu, 23 Jun 2022 10:58:30 -0700
Ismail Kose <ihkose@gmail.com> wrote:

> Signed-off
> ismail

Tag for this would be
Acked-by
as you aren't involved in the sign of chain for this one, rather you
are reviewing.

If you can confirm that it would be much appreciated.
> 
> 
> On Tue, Jun 21, 2022 at 1:19 PM 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: Philippe Reynes <tremyfr@yahoo.fr>
> > ---
> >  drivers/iio/dac/max5821.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
> > index 540f9ea7cada..e001b594d5b1 100644
> > --- a/drivers/iio/dac/max5821.c
> > +++ b/drivers/iio/dac/max5821.c
> > @@ -267,7 +267,7 @@ static int max5821_write_raw(struct iio_dev *indio_dev,
> >         }
> >  }
> >
> > -static int __maybe_unused max5821_suspend(struct device *dev)
> > +static int max5821_suspend(struct device *dev)
> >  {
> >         u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
> >                          MAX5821_EXTENDED_DAC_A |
> > @@ -277,7 +277,7 @@ static int __maybe_unused max5821_suspend(struct
> > device *dev)
> >         return i2c_master_send(to_i2c_client(dev), outbuf, 2);
> >  }
> >
> > -static int __maybe_unused max5821_resume(struct device *dev)
> > +static int max5821_resume(struct device *dev)
> >  {
> >         u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
> >                          MAX5821_EXTENDED_DAC_A |
> > @@ -287,7 +287,8 @@ static int __maybe_unused max5821_resume(struct device
> > *dev)
> >         return i2c_master_send(to_i2c_client(dev), outbuf, 2);
> >  }
> >
> > -static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
> > +static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
> > +                               max5821_resume);
> >
> >  static const struct iio_info max5821_info = {
> >         .read_raw = max5821_read_raw,
> > @@ -374,7 +375,7 @@ static struct i2c_driver max5821_driver = {
> >         .driver = {
> >                 .name   = "max5821",
> >                 .of_match_table = max5821_of_match,
> > -               .pm     = &max5821_pm_ops,
> > +               .pm     = pm_sleep_ptr(&max5821_pm_ops),
> >         },
> >         .probe          = max5821_probe,
> >         .id_table       = max5821_id,
> > --
> > 2.36.1
> >
> >
diff mbox series

Patch

diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
index 540f9ea7cada..e001b594d5b1 100644
--- a/drivers/iio/dac/max5821.c
+++ b/drivers/iio/dac/max5821.c
@@ -267,7 +267,7 @@  static int max5821_write_raw(struct iio_dev *indio_dev,
 	}
 }
 
-static int __maybe_unused max5821_suspend(struct device *dev)
+static int max5821_suspend(struct device *dev)
 {
 	u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
 			 MAX5821_EXTENDED_DAC_A |
@@ -277,7 +277,7 @@  static int __maybe_unused max5821_suspend(struct device *dev)
 	return i2c_master_send(to_i2c_client(dev), outbuf, 2);
 }
 
-static int __maybe_unused max5821_resume(struct device *dev)
+static int max5821_resume(struct device *dev)
 {
 	u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
 			 MAX5821_EXTENDED_DAC_A |
@@ -287,7 +287,8 @@  static int __maybe_unused max5821_resume(struct device *dev)
 	return i2c_master_send(to_i2c_client(dev), outbuf, 2);
 }
 
-static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
+				max5821_resume);
 
 static const struct iio_info max5821_info = {
 	.read_raw = max5821_read_raw,
@@ -374,7 +375,7 @@  static struct i2c_driver max5821_driver = {
 	.driver = {
 		.name	= "max5821",
 		.of_match_table = max5821_of_match,
-		.pm     = &max5821_pm_ops,
+		.pm     = pm_sleep_ptr(&max5821_pm_ops),
 	},
 	.probe		= max5821_probe,
 	.id_table	= max5821_id,