From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: <linux-iio@vger.kernel.org>, Paul Cercueil <paul@crapouillou.net>,
"Arnd Bergmann" <arnd@arndb.de>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Gwendal Grignou" <gwendal@chromium.org>
Subject: Re: [PATCH v2 48/51] iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Date: Wed, 5 Jan 2022 10:52:04 +0000 [thread overview]
Message-ID: <20220105105204.00000775@Huawei.com> (raw)
In-Reply-To: <20220102125617.1259804-49-jic23@kernel.org>
On Sun, 2 Jan 2022 12:56:14 +0000
Jonathan Cameron <jic23@kernel.org> wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based config guards.
>
> Removing instances of this approach from IIO also stops them being
> copied into new drivers.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
I missed that there were some CONFIG_PM guards around iio_priv()->save
that also need dropping. Will do that in v3.
Jonathan
> ---
> drivers/iio/dac/m62332.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
> index 225b1a374dc1..4a413936fabb 100644
> --- a/drivers/iio/dac/m62332.c
> +++ b/drivers/iio/dac/m62332.c
> @@ -124,7 +124,6 @@ static int m62332_write_raw(struct iio_dev *indio_dev,
> return -EINVAL;
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int m62332_suspend(struct device *dev)
> {
> struct i2c_client *client = to_i2c_client(dev);
> @@ -156,11 +155,7 @@ static int m62332_resume(struct device *dev)
> return m62332_set_value(indio_dev, data->save[1], 1);
> }
>
> -static SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume);
> -#define M62332_PM_OPS (&m62332_pm_ops)
> -#else
> -#define M62332_PM_OPS NULL
> -#endif
> +DEFINE_SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume);
>
> static const struct iio_info m62332_info = {
> .read_raw = m62332_read_raw,
> @@ -246,7 +241,7 @@ MODULE_DEVICE_TABLE(i2c, m62332_id);
> static struct i2c_driver m62332_driver = {
> .driver = {
> .name = "m62332",
> - .pm = M62332_PM_OPS,
> + .pm = pm_sleep_ptr(&m62332_pm_ops),
> },
> .probe = m62332_probe,
> .remove = m62332_remove,
next prev parent reply other threads:[~2022-01-05 10:52 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 12:55 [PATCH v2 00/51] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 14:15 ` Arnd Bergmann
2022-01-03 15:24 ` Jonathan Cameron
2022-01-03 17:58 ` Arnd Bergmann
2022-01-04 14:16 ` Jonathan Cameron
2022-01-04 14:24 ` Rafael J. Wysocki
2022-01-04 15:08 ` Paul Cercueil
2022-01-04 18:06 ` Arnd Bergmann
2022-01-02 12:55 ` [PATCH v2 02/51] iio:accel:da280: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 03/51] iio:accel:dmard06: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 04/51] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 05/51] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 06/51] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 07/51] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 08/51] iio:accel:mma9553: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 09/51] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 10/51] iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:08 ` Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 11/51] iio:adc:ab8500: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 12/51] iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 13/51] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 14/51] iio:adc:palmas_gpadc: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 15/51] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 16/51] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 17/51] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 18/51] iio:adc:twl6030: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 19/51] iio:adc:vf610: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 20/51] iio:common:ssp: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 21/51] iio:dac:vf610: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 22/51] iio:light:apds9300: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 23/51] iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 24/51] iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 25/51] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 26/51] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 27/51] iio:light:jsa1212: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 28/51] iio:light:ltr501: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 29/51] iio:light:stk3310: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 30/51] iio:light:tcs3414: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 31/51] iio:light:tcs3472: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 32/51] iio:light:tsl2563: " Jonathan Cameron
2022-01-02 12:55 ` [PATCH v2 33/51] iio:light:tsl4531: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 34/51] iio:light:us5182: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:12 ` Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 35/51] iio:magn:ak8975: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 36/51] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 37/51] iio:magn:mmc35240: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 38/51] iio:pressure:mpl3115: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 39/51] iio:proximity:as3935: " Jonathan Cameron
2022-01-04 6:41 ` Gwendal Grignou
2022-01-02 12:56 ` [PATCH v2 40/51] iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 41/51] iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 42/51] iio:proximity:sx9500: " Jonathan Cameron
2022-01-03 18:58 ` Gwendal Grignou
2022-01-02 12:56 ` [PATCH v2 43/51] iio:temperature:tmp006: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 44/51] iio:temperature:tmp007: " Jonathan Cameron
2022-01-03 6:03 ` Manivannan Sadhasivam
2022-01-02 12:56 ` [PATCH v2 45/51] iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 46/51] iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 47/51] iio:accel:bma180: " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 48/51] iio:dac:m62332: " Jonathan Cameron
2022-01-05 10:52 ` Jonathan Cameron [this message]
2022-01-02 12:56 ` [PATCH v2 49/51] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 50/51] iio:light:rpr0521: Switch from CONFIG_PM " Jonathan Cameron
2022-01-02 12:56 ` [PATCH v2 51/51] iio:temperature:mlx90614: Switch from CONFIG_PM* " 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=20220105105204.00000775@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=arnd@arndb.de \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=linux-iio@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).