From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: "open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Paul Cercueil <paul@crapouillou.net>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH 43/49] iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused
Date: Sun, 28 Nov 2021 16:44:30 +0000 [thread overview]
Message-ID: <20211128164344.1fe77e9f@jic23-huawei> (raw)
In-Reply-To: <CAJCx=gkO4a4dF7ZAEnJhLAzveDO2kKofe+uuAHb8X8ULxgC9RQ@mail.gmail.com>
On Tue, 23 Nov 2021 14:22:46 -0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> On Tue, Nov 23, 2021 at 1:07 PM 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 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>
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>
>
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
A clang build (without this patch) noted that lidar_write_power() is only used
in these functions (so I got an unused function warning).
I'll add a maybe_unused to that as well if needed (subject to the
other discussion on how to do this better).
Thanks,
Jonathan
>
> > ---
> > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 ++++------
> > 1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > index 27026c060ab9..6adc2a0c27cb 100644
> > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > @@ -338,8 +338,7 @@ static const struct of_device_id lidar_dt_ids[] = {
> > };
> > MODULE_DEVICE_TABLE(of, lidar_dt_ids);
> >
> > -#ifdef CONFIG_PM
> > -static int lidar_pm_runtime_suspend(struct device *dev)
> > +static __maybe_unused int lidar_pm_runtime_suspend(struct device *dev)
> > {
> > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> > struct lidar_data *data = iio_priv(indio_dev);
> > @@ -347,7 +346,7 @@ static int lidar_pm_runtime_suspend(struct device *dev)
> > return lidar_write_power(data, 0x0f);
> > }
> >
> > -static int lidar_pm_runtime_resume(struct device *dev)
> > +static __maybe_unused int lidar_pm_runtime_resume(struct device *dev)
> > {
> > struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> > struct lidar_data *data = iio_priv(indio_dev);
> > @@ -358,9 +357,8 @@ static int lidar_pm_runtime_resume(struct device *dev)
> >
> > return ret;
> > }
> > -#endif
> >
> > -static const struct dev_pm_ops lidar_pm_ops = {
> > +static __maybe_unused const struct dev_pm_ops lidar_pm_ops = {
> > SET_RUNTIME_PM_OPS(lidar_pm_runtime_suspend,
> > lidar_pm_runtime_resume, NULL)
> > };
> > @@ -369,7 +367,7 @@ static struct i2c_driver lidar_driver = {
> > .driver = {
> > .name = LIDAR_DRV_NAME,
> > .of_match_table = lidar_dt_ids,
> > - .pm = &lidar_pm_ops,
> > + .pm = pm_ptr(&lidar_pm_ops),
> > },
> > .probe = lidar_probe,
> > .remove = lidar_remove,
> > --
> > 2.34.0
> >
next prev parent reply other threads:[~2021-11-28 16:41 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 21:09 [PATCH 00/49] iio: Tree wide switch from CONFIG_PM* to __maybe_unused etc Jonathan Cameron
2021-11-23 21:09 ` [PATCH 01/49] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Jonathan Cameron
2021-11-23 21:09 ` [PATCH 02/49] iio:accel:da280: " Jonathan Cameron
2021-11-23 22:17 ` Paul Cercueil
2021-11-24 9:48 ` Jonathan Cameron
2021-11-23 21:09 ` [PATCH 03/49] iio:accel:dmard06: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 04/49] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 05/49] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 21:37 ` Hans de Goede
2021-11-23 21:09 ` [PATCH 06/49] iio:accel:mma7660: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 07/49] iio:accel:mma9551: Switch from CONFIG_PM " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 08/49] iio:accel:mma9553: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 09/49] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 10/49] iio:accel:kxsd9: Switch from CONFIG_PM " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 11/49] iio:adc:ab8500: " Jonathan Cameron
2021-11-25 16:55 ` Linus Walleij
2021-11-23 21:09 ` [PATCH 12/49] iio:adc:ad7606: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-01 16:27 ` Jonathan Cameron
2021-11-23 21:09 ` [PATCH 13/49] iio:adc:at91-adc: " Jonathan Cameron
2021-11-24 9:16 ` Alexandre Belloni
2021-11-23 21:09 ` [PATCH 14/49] iio:adc:exynos_adc: " Jonathan Cameron
2021-11-25 8:50 ` Krzysztof Kozlowski
2021-11-23 21:09 ` [PATCH 15/49] iio:adc:palmas_gpadc: " Jonathan Cameron
2022-01-01 16:38 ` Jonathan Cameron
2021-11-23 21:09 ` [PATCH 16/49] iio:adc:stm32:Switch from CONFIG_PM " Jonathan Cameron
2021-11-24 9:33 ` Fabrice Gasnier
2021-11-23 21:09 ` [PATCH 17/49] iio:adc:rcar: Switch " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 18/49] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 19/49] iio:adc:twl6030: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 20/49] iio:adc:vf610: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 21/49] iio:common:ssp: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 22/49] iio:dac:vf610: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 23/49] iio:light:apds9300: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 24/49] iio:light:bh1780: Switch from CONFIG_PM " Jonathan Cameron
2021-11-25 16:56 ` Linus Walleij
2021-11-23 21:09 ` [PATCH 25/49] iio:light:cm3232: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 26/49] iio:light:isl29018: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 27/49] iio:light:isl29125: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 28/49] iio:light:jsa1212: " Jonathan Cameron
2021-11-23 21:09 ` [PATCH 29/49] iio:light:ltr501: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 30/49] iio:light:stk3310: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 31/49] iio:light:tcs3414: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 32/49] iio:light:tcs3472: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 33/49] iio:light:tsl2563: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 34/49] iio:light:tsl4531: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 35/49] iio:light:us5182: Switch from CONFIG_PM " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 36/49] iio:magn:ak8975: " Jonathan Cameron
2021-11-23 22:24 ` Matt Ranostay
2021-11-23 21:10 ` [PATCH 37/49] iio:magn:hmc5843: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-01 17:40 ` Jonathan Cameron
2021-11-23 21:10 ` [PATCH 38/49] iio:magn:mag3110: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 39/49] iio:magn:mmc35240: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 40/49] iio:pressure:mpl3115: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 41/49] iio:pressure:bmp280: Switch from CONFIG_PM " Jonathan Cameron
2021-11-25 16:56 ` Linus Walleij
2022-01-01 17:50 ` Jonathan Cameron
2021-11-23 21:10 ` [PATCH 42/49] iio:proximity:as3935: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 22:23 ` Matt Ranostay
2021-11-23 21:10 ` [PATCH 43/49] iio:proximity:pulsedlight: Switch from CONFIG_PM " Jonathan Cameron
2021-11-23 22:22 ` Matt Ranostay
2021-11-28 16:44 ` Jonathan Cameron [this message]
2021-11-23 21:10 ` [PATCH 44/49] iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 45/49] iio:proximity:sx9500: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 46/49] iio:temperature:tmp006: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 47/49] iio:temperature:tmp007: " Jonathan Cameron
2021-11-23 21:10 ` [PATCH 48/49] iio:gyro:mpu3050: Switch from CONFIG_PM " Jonathan Cameron
2021-11-25 16:56 ` Linus Walleij
2022-01-01 18:00 ` Jonathan Cameron
2021-11-23 21:10 ` [PATCH 49/49] iio:chemical:atlas: " Jonathan Cameron
2021-11-23 22:22 ` Matt Ranostay
2021-11-23 22:11 ` [PATCH 00/49] iio: Tree wide switch from CONFIG_PM* to __maybe_unused etc Paul Cercueil
2021-11-24 7:29 ` Arnd Bergmann
2021-11-24 10:11 ` Jonathan Cameron
2021-11-24 10:58 ` Paul Cercueil
2021-11-24 12:23 ` Arnd Bergmann
2021-11-24 15:10 ` Paul Cercueil
2021-11-27 18:09 ` Jonathan Cameron
2021-11-28 9:17 ` Arnd Bergmann
2021-11-28 12:44 ` Paul Cercueil
2021-11-27 18:02 ` Jonathan Cameron
2021-11-28 9:26 ` Arnd Bergmann
2021-11-28 12:30 ` Paul Cercueil
2021-11-24 0:58 ` Brian Masney
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=20211128164344.1fe77e9f@jic23-huawei \
--to=jic23@jic23.retrosnub.co.uk \
--cc=Jonathan.Cameron@huawei.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=matt.ranostay@konsulko.com \
--cc=paul@crapouillou.net \
/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).