linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>,
	Arnd Bergmann <arnd@arndb.de>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Gwendal Grignou <gwendal@chromium.org>
Subject: [PATCH v3 35/50] iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Date: Sun, 30 Jan 2022 19:31:32 +0000	[thread overview]
Message-ID: <20220130193147.279148-36-jic23@kernel.org> (raw)
In-Reply-To: <20220130193147.279148-1-jic23@kernel.org>

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.

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/proximity/sx9500.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 3e4ddb2e8c2b..42589d6200ad 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -993,7 +993,6 @@ static int sx9500_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sx9500_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1030,11 +1029,8 @@ static int sx9500_resume(struct device *dev)
 
 	return ret;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static const struct dev_pm_ops sx9500_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume);
 
 static const struct acpi_device_id sx9500_acpi_match[] = {
 	{"SSX9500", 0},
@@ -1060,7 +1056,7 @@ static struct i2c_driver sx9500_driver = {
 		.name	= SX9500_DRIVER_NAME,
 		.acpi_match_table = ACPI_PTR(sx9500_acpi_match),
 		.of_match_table = of_match_ptr(sx9500_of_match),
-		.pm = &sx9500_pm_ops,
+		.pm = pm_sleep_ptr(&sx9500_pm_ops),
 	},
 	.probe		= sx9500_probe,
 	.remove		= sx9500_remove,
-- 
2.35.1


  parent reply	other threads:[~2022-01-30 19:27 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 02/50] iio:accel:da280: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 03/50] iio:accel:dmard06: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 08/50] iio:accel:mma9553: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 12/50] iio:adc:palmas_gpadc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 14/50] iio:adc:twl6030: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 15/50] iio:adc:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 16/50] iio:common:ssp: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 17/50] iio:dac:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 18/50] iio:light:apds9300: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 19/50] iio:light:cm3232: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 22/50] iio:light:jsa1212: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 23/50] iio:light:ltr501: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 24/50] iio:light:stk3310: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 25/50] iio:light:tcs3414: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 26/50] iio:light:tcs3472: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 27/50] iio:light:tsl2563: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 28/50] iio:light:tsl4531: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 31/50] iio:magn:mmc35240: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 32/50] iio:pressure:mpl3115: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 33/50] iio:proximity:as3935: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 34/50] iio:proximity:rfd77492: " Jonathan Cameron
2022-01-30 19:31 ` Jonathan Cameron [this message]
2022-01-30 19:31 ` [PATCH v3 36/50] iio:temperature:tmp006: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 37/50] iio:temperature:tmp007: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 38/50] iio:accel:stk8312: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 39/50] iio:accel:bma180: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 40/50] iio:dac:m62332: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
2022-01-31 13:16   ` Crt Mori
2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
2022-02-21 19:36   ` Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 46/50] iio:light:bh1780: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 47/50] iio:proximity:pulsedlight: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 48/50] iio:chemical:atlas: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 49/50] iio:light:rpr0521: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
2022-02-09 14:04   ` Fabrice Gasnier
2022-01-31 13:33 ` [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Arnd Bergmann
2022-02-09 11:41 ` Paul Cercueil
2022-02-18 11:47   ` 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=20220130193147.279148-36-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=gwendal@chromium.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).