Message ID | 20220807190414.1039028-2-jic23@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | iio: Convert some drivers from deprecated UNIVERSAL_DEV_PM_OPS() | expand |
Hello, looks good, thanks for the patch. Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Thanks, JB From: Jonathan Cameron <jic23@kernel.org> Sent: Sunday, August 7, 2022 21:04 To: linux-iio@vger.kernel.org <linux-iio@vger.kernel.org> Cc: Paul Cercueil <paul@crapouillou.net>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Crt Mori <cmo@melexis.com>; Jonathan Cameron <Jonathan.Cameron@huawei.com> Subject: [PATCH 1/2] iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS(). [CAUTION] This is EXTERNAL email. Do not click any links or open attachments unless you recognize the sender and know the content is safe. ====================================================================== From: Jonathan Cameron <Jonathan.Cameron@huawei.com> The suspend and resume callbacks in this driver appear to be safe to call repeatedly, but why do so when we can use the DEFINE_RUNTIME_DEV_PM_OPS() macro to supply callbacks that check if we are already runtime suspended before doing unnecessary work. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> --- drivers/iio/pressure/icp10100.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/pressure/icp10100.c b/drivers/iio/pressure/icp10100.c index af4621eaa6b5..b62f28585db5 100644 --- a/drivers/iio/pressure/icp10100.c +++ b/drivers/iio/pressure/icp10100.c @@ -595,7 +595,7 @@ static int icp10100_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -static int __maybe_unused icp10100_suspend(struct device *dev) +static int icp10100_suspend(struct device *dev) { struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); int ret; @@ -607,7 +607,7 @@ static int __maybe_unused icp10100_suspend(struct device *dev) return ret; } -static int __maybe_unused icp10100_resume(struct device *dev) +static int icp10100_resume(struct device *dev) { struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); int ret; @@ -626,8 +626,8 @@ static int __maybe_unused icp10100_resume(struct device *dev) return ret; } -static UNIVERSAL_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, - NULL); +static DEFINE_RUNTIME_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, + NULL); static const struct of_device_id icp10100_of_match[] = { { @@ -646,7 +646,7 @@ MODULE_DEVICE_TABLE(i2c, icp10100_id); static struct i2c_driver icp10100_driver = { .driver = { .name = "icp10100", - .pm = &icp10100_pm, + .pm = pm_ptr(&icp10100_pm), .of_match_table = icp10100_of_match, }, .probe = icp10100_probe,
On Tue, 16 Aug 2022 13:13:52 +0000 Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com> wrote: > Hello, > > looks good, thanks for the patch. > > Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Applied > > Thanks, > JB > > > From: Jonathan Cameron <jic23@kernel.org> > Sent: Sunday, August 7, 2022 21:04 > To: linux-iio@vger.kernel.org <linux-iio@vger.kernel.org> > Cc: Paul Cercueil <paul@crapouillou.net>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Crt Mori <cmo@melexis.com>; Jonathan Cameron <Jonathan.Cameron@huawei.com> > Subject: [PATCH 1/2] iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS(). > _ > [CAUTION] This is EXTERNAL email. Do not click any links or open attachments unless you recognize the sender and know the content is safe. > > ====================================================================== > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > The suspend and resume callbacks in this driver appear to be safe > to call repeatedly, but why do so when we can use the > DEFINE_RUNTIME_DEV_PM_OPS() macro to supply callbacks that check if > we are already runtime suspended before doing unnecessary work. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> > --- > _drivers/iio/pressure/icp10100.c | 10 +++++----- > _1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/pressure/icp10100.c b/drivers/iio/pressure/icp10100.c > index af4621eaa6b5..b62f28585db5 100644 > --- a/drivers/iio/pressure/icp10100.c > +++ b/drivers/iio/pressure/icp10100.c > @@ -595,7 +595,7 @@ static int icp10100_probe(struct i2c_client *client, > ________ return devm_iio_device_register(&client->dev, indio_dev); > _} > _ > -static int __maybe_unused icp10100_suspend(struct device *dev) > +static int icp10100_suspend(struct device *dev) > _{ > ________ struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); > ________ int ret; > @@ -607,7 +607,7 @@ static int __maybe_unused icp10100_suspend(struct device *dev) > ________ return ret; > _} > _ > -static int __maybe_unused icp10100_resume(struct device *dev) > +static int icp10100_resume(struct device *dev) > _{ > ________ struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); > ________ int ret; > @@ -626,8 +626,8 @@ static int __maybe_unused icp10100_resume(struct device *dev) > ________ return ret; > _} > _ > -static UNIVERSAL_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, > -__________________________ NULL); > +static DEFINE_RUNTIME_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, > +_______________________________ NULL); > _ > _static const struct of_device_id icp10100_of_match[] = { > ________ { > @@ -646,7 +646,7 @@ MODULE_DEVICE_TABLE(i2c, icp10100_id); > _static struct i2c_driver icp10100_driver = { > ________ .driver = { > ________________ .name = "icp10100", > -______________ .pm = &icp10100_pm, > +______________ .pm = pm_ptr(&icp10100_pm), > ________________ .of_match_table = icp10100_of_match, > ________ }, > ________ .probe = icp10100_probe,
diff --git a/drivers/iio/pressure/icp10100.c b/drivers/iio/pressure/icp10100.c index af4621eaa6b5..b62f28585db5 100644 --- a/drivers/iio/pressure/icp10100.c +++ b/drivers/iio/pressure/icp10100.c @@ -595,7 +595,7 @@ static int icp10100_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -static int __maybe_unused icp10100_suspend(struct device *dev) +static int icp10100_suspend(struct device *dev) { struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); int ret; @@ -607,7 +607,7 @@ static int __maybe_unused icp10100_suspend(struct device *dev) return ret; } -static int __maybe_unused icp10100_resume(struct device *dev) +static int icp10100_resume(struct device *dev) { struct icp10100_state *st = iio_priv(dev_get_drvdata(dev)); int ret; @@ -626,8 +626,8 @@ static int __maybe_unused icp10100_resume(struct device *dev) return ret; } -static UNIVERSAL_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, - NULL); +static DEFINE_RUNTIME_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume, + NULL); static const struct of_device_id icp10100_of_match[] = { { @@ -646,7 +646,7 @@ MODULE_DEVICE_TABLE(i2c, icp10100_id); static struct i2c_driver icp10100_driver = { .driver = { .name = "icp10100", - .pm = &icp10100_pm, + .pm = pm_ptr(&icp10100_pm), .of_match_table = icp10100_of_match, }, .probe = icp10100_probe,