Message ID | 20220807190414.1039028-3-jic23@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | iio: Convert some drivers from deprecated UNIVERSAL_DEV_PM_OPS() | expand |
Not sure if I should apply both but: Acked-by: Crt Mori <cmo@melexis.com> Tested-by: Crt Mori <cmo@melexis.com> On Sun, 7 Aug 2022 at 20:54, Jonathan Cameron <jic23@kernel.org> wrote: > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > The callbacks in this driver are simple and it doesn't matter if > they are unnecessarily called multiple times. However, we might as > well not repeat the effort if the device is already suspended. > The new DEFINE_RUNTIME_DEV_PM_OPS() has the advantage that we don't > need to mark the callbacks __maybe_unused. The compiler will still > remove them for us if CONFIG_PM is not set. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Crt Mori <cmo@melexis.com> > --- > drivers/iio/temperature/mlx90632.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c > index 7ee7ff8047a4..9fc69d099784 100644 > --- a/drivers/iio/temperature/mlx90632.c > +++ b/drivers/iio/temperature/mlx90632.c > @@ -952,7 +952,7 @@ static const struct of_device_id mlx90632_of_match[] = { > }; > MODULE_DEVICE_TABLE(of, mlx90632_of_match); > > -static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > +static int mlx90632_pm_suspend(struct device *dev) > { > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > struct mlx90632_data *data = iio_priv(indio_dev); > @@ -960,7 +960,7 @@ static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > return mlx90632_sleep(data); > } > > -static int __maybe_unused mlx90632_pm_resume(struct device *dev) > +static int mlx90632_pm_resume(struct device *dev) > { > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > struct mlx90632_data *data = iio_priv(indio_dev); > @@ -968,14 +968,14 @@ static int __maybe_unused mlx90632_pm_resume(struct device *dev) > return mlx90632_wakeup(data); > } > > -static UNIVERSAL_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > - mlx90632_pm_resume, NULL); > +static DEFINE_RUNTIME_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > + mlx90632_pm_resume, NULL); > > static struct i2c_driver mlx90632_driver = { > .driver = { > .name = "mlx90632", > .of_match_table = mlx90632_of_match, > - .pm = &mlx90632_pm_ops, > + .pm = pm_ptr(&mlx90632_pm_ops), > }, > .probe = mlx90632_probe, > .remove = mlx90632_remove, > -- > 2.37.1 >
On Mon, 8 Aug 2022 13:26:42 +0200 Crt Mori <cmo@melexis.com> wrote: > Not sure if I should apply both but: > > Acked-by: Crt Mori <cmo@melexis.com> > Tested-by: Crt Mori <cmo@melexis.com> Absolutely. Both is perfect. Thanks! > > > On Sun, 7 Aug 2022 at 20:54, Jonathan Cameron <jic23@kernel.org> wrote: > > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > The callbacks in this driver are simple and it doesn't matter if > > they are unnecessarily called multiple times. However, we might as > > well not repeat the effort if the device is already suspended. > > The new DEFINE_RUNTIME_DEV_PM_OPS() has the advantage that we don't > > need to mark the callbacks __maybe_unused. The compiler will still > > remove them for us if CONFIG_PM is not set. > > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Cc: Crt Mori <cmo@melexis.com> > > --- > > drivers/iio/temperature/mlx90632.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c > > index 7ee7ff8047a4..9fc69d099784 100644 > > --- a/drivers/iio/temperature/mlx90632.c > > +++ b/drivers/iio/temperature/mlx90632.c > > @@ -952,7 +952,7 @@ static const struct of_device_id mlx90632_of_match[] = { > > }; > > MODULE_DEVICE_TABLE(of, mlx90632_of_match); > > > > -static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > > +static int mlx90632_pm_suspend(struct device *dev) > > { > > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > > struct mlx90632_data *data = iio_priv(indio_dev); > > @@ -960,7 +960,7 @@ static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > > return mlx90632_sleep(data); > > } > > > > -static int __maybe_unused mlx90632_pm_resume(struct device *dev) > > +static int mlx90632_pm_resume(struct device *dev) > > { > > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > > struct mlx90632_data *data = iio_priv(indio_dev); > > @@ -968,14 +968,14 @@ static int __maybe_unused mlx90632_pm_resume(struct device *dev) > > return mlx90632_wakeup(data); > > } > > > > -static UNIVERSAL_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > > - mlx90632_pm_resume, NULL); > > +static DEFINE_RUNTIME_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > > + mlx90632_pm_resume, NULL); > > > > static struct i2c_driver mlx90632_driver = { > > .driver = { > > .name = "mlx90632", > > .of_match_table = mlx90632_of_match, > > - .pm = &mlx90632_pm_ops, > > + .pm = pm_ptr(&mlx90632_pm_ops), > > }, > > .probe = mlx90632_probe, > > .remove = mlx90632_remove, > > -- > > 2.37.1 > >
On Thu, 11 Aug 2022 15:18:34 +0100 Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote: > On Mon, 8 Aug 2022 13:26:42 +0200 > Crt Mori <cmo@melexis.com> wrote: > > > Not sure if I should apply both but: > > > > Acked-by: Crt Mori <cmo@melexis.com> > > Tested-by: Crt Mori <cmo@melexis.com> > Absolutely. Both is perfect. Thanks! Given I forgot to pick this up and your set is moving towards being merged, I'll not bother with this one. Jonathan > > > > > > On Sun, 7 Aug 2022 at 20:54, Jonathan Cameron <jic23@kernel.org> wrote: > > > > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > > > The callbacks in this driver are simple and it doesn't matter if > > > they are unnecessarily called multiple times. However, we might as > > > well not repeat the effort if the device is already suspended. > > > The new DEFINE_RUNTIME_DEV_PM_OPS() has the advantage that we don't > > > need to mark the callbacks __maybe_unused. The compiler will still > > > remove them for us if CONFIG_PM is not set. > > > > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > Cc: Crt Mori <cmo@melexis.com> > > > --- > > > drivers/iio/temperature/mlx90632.c | 10 +++++----- > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c > > > index 7ee7ff8047a4..9fc69d099784 100644 > > > --- a/drivers/iio/temperature/mlx90632.c > > > +++ b/drivers/iio/temperature/mlx90632.c > > > @@ -952,7 +952,7 @@ static const struct of_device_id mlx90632_of_match[] = { > > > }; > > > MODULE_DEVICE_TABLE(of, mlx90632_of_match); > > > > > > -static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > > > +static int mlx90632_pm_suspend(struct device *dev) > > > { > > > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > > > struct mlx90632_data *data = iio_priv(indio_dev); > > > @@ -960,7 +960,7 @@ static int __maybe_unused mlx90632_pm_suspend(struct device *dev) > > > return mlx90632_sleep(data); > > > } > > > > > > -static int __maybe_unused mlx90632_pm_resume(struct device *dev) > > > +static int mlx90632_pm_resume(struct device *dev) > > > { > > > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); > > > struct mlx90632_data *data = iio_priv(indio_dev); > > > @@ -968,14 +968,14 @@ static int __maybe_unused mlx90632_pm_resume(struct device *dev) > > > return mlx90632_wakeup(data); > > > } > > > > > > -static UNIVERSAL_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > > > - mlx90632_pm_resume, NULL); > > > +static DEFINE_RUNTIME_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, > > > + mlx90632_pm_resume, NULL); > > > > > > static struct i2c_driver mlx90632_driver = { > > > .driver = { > > > .name = "mlx90632", > > > .of_match_table = mlx90632_of_match, > > > - .pm = &mlx90632_pm_ops, > > > + .pm = pm_ptr(&mlx90632_pm_ops), > > > }, > > > .probe = mlx90632_probe, > > > .remove = mlx90632_remove, > > > -- > > > 2.37.1 > > > >
diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index 7ee7ff8047a4..9fc69d099784 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -952,7 +952,7 @@ static const struct of_device_id mlx90632_of_match[] = { }; MODULE_DEVICE_TABLE(of, mlx90632_of_match); -static int __maybe_unused mlx90632_pm_suspend(struct device *dev) +static int mlx90632_pm_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mlx90632_data *data = iio_priv(indio_dev); @@ -960,7 +960,7 @@ static int __maybe_unused mlx90632_pm_suspend(struct device *dev) return mlx90632_sleep(data); } -static int __maybe_unused mlx90632_pm_resume(struct device *dev) +static int mlx90632_pm_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mlx90632_data *data = iio_priv(indio_dev); @@ -968,14 +968,14 @@ static int __maybe_unused mlx90632_pm_resume(struct device *dev) return mlx90632_wakeup(data); } -static UNIVERSAL_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, - mlx90632_pm_resume, NULL); +static DEFINE_RUNTIME_DEV_PM_OPS(mlx90632_pm_ops, mlx90632_pm_suspend, + mlx90632_pm_resume, NULL); static struct i2c_driver mlx90632_driver = { .driver = { .name = "mlx90632", .of_match_table = mlx90632_of_match, - .pm = &mlx90632_pm_ops, + .pm = pm_ptr(&mlx90632_pm_ops), }, .probe = mlx90632_probe, .remove = mlx90632_remove,