From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <linux-iio@vger.kernel.org>, Paul Cercueil <paul@crapouillou.net>,
"Linux PM" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
Date: Wed, 6 Apr 2022 14:09:02 +0100 [thread overview]
Message-ID: <20220406140902.0000021a@Huawei.com> (raw)
In-Reply-To: <CAJZ5v0gUECCmFJoVnmR8SK-pBg5v4QrtLgeKT7VTmgdykuZAzA@mail.gmail.com>
On Tue, 5 Apr 2022 20:19:11 +0200
"Rafael J. Wysocki" <rafael@kernel.org> wrote:
> On Fri, Apr 1, 2022 at 4:06 PM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > Whilst here move to the new infrastructure using pm_sleep_ptr()
> > and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused
> > code if CONFIG_SLEEP is not defined.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
> > ---
> > drivers/iio/chemical/scd30.h | 5 +----
> > drivers/iio/chemical/scd30_core.c | 8 ++++----
> > drivers/iio/chemical/scd30_i2c.c | 2 +-
> > drivers/iio/chemical/scd30_serial.c | 2 +-
> > 4 files changed, 7 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h
> > index f60127bfe0f4..1ac9f3f79271 100644
> > --- a/drivers/iio/chemical/scd30.h
> > +++ b/drivers/iio/chemical/scd30.h
> > @@ -68,10 +68,7 @@ struct scd30_state {
> > scd30_command_t command;
> > };
> >
> > -int scd30_suspend(struct device *dev);
> > -int scd30_resume(struct device *dev);
> > -
> > -static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
> > +extern const struct dev_pm_ops scd30_pm_ops;
> >
> > int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
> >
> > diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
> > index 9fe6bbe9ee04..6c6c11c2772a 100644
> > --- a/drivers/iio/chemical/scd30_core.c
> > +++ b/drivers/iio/chemical/scd30_core.c
> > @@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
> > IIO_CHAN_SOFT_TIMESTAMP(3),
> > };
> >
> > -int __maybe_unused scd30_suspend(struct device *dev)
> > +static int scd30_suspend(struct device *dev)
> > {
> > struct iio_dev *indio_dev = dev_get_drvdata(dev);
> > struct scd30_state *state = iio_priv(indio_dev);
> > @@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
> >
> > return regulator_disable(state->vdd);
> > }
> > -EXPORT_SYMBOL(scd30_suspend);
> >
> > -int __maybe_unused scd30_resume(struct device *dev)
> > +static int scd30_resume(struct device *dev)
> > {
> > struct iio_dev *indio_dev = dev_get_drvdata(dev);
> > struct scd30_state *state = iio_priv(indio_dev);
> > @@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
> >
> > return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
> > }
> > -EXPORT_SYMBOL(scd30_resume);
> > +
> > +EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
> >
> > static void scd30_stop_meas(void *data)
> > {
> > diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
> > index 875892a070ee..7c332e4e8e46 100644
> > --- a/drivers/iio/chemical/scd30_i2c.c
> > +++ b/drivers/iio/chemical/scd30_i2c.c
> > @@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
> > .driver = {
> > .name = KBUILD_MODNAME,
> > .of_match_table = scd30_i2c_of_match,
> > - .pm = &scd30_pm_ops,
> > + .pm = pm_sleep_ptr(&scd30_pm_ops),
> > },
> > .probe_new = scd30_i2c_probe,
> > };
> > diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c
> > index 568b34486c44..8664f3ce6b33 100644
> > --- a/drivers/iio/chemical/scd30_serial.c
> > +++ b/drivers/iio/chemical/scd30_serial.c
> > @@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
> > .driver = {
> > .name = KBUILD_MODNAME,
> > .of_match_table = scd30_serdev_of_match,
> > - .pm = &scd30_pm_ops,
> > + .pm = pm_sleep_ptr(&scd30_pm_ops),
> > },
> > .probe = scd30_serdev_probe,
> > };
> > --
>
> Applied as 5.19 material along with the [2-3/3].
>
> Please let me know if you need a non-mutable branch to pull from in
> order to base other work on these commits.
Yes please. A non-mutable branch would be great.
Thanks,
Jonathan
>
> Thanks!
next prev parent reply other threads:[~2022-04-06 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 14:06 [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet Jonathan Cameron
2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
2022-04-05 18:19 ` Rafael J. Wysocki
2022-04-06 13:09 ` Jonathan Cameron [this message]
2022-04-01 14:06 ` [PATCH v2 2/3] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv Jonathan Cameron
2022-04-01 14:06 ` [PATCH v2 3/3] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220406140902.0000021a@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).