All of lore.kernel.org
 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>
Subject: [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Date: Sun, 30 Jan 2022 19:31:06 +0000	[thread overview]
Message-ID: <20220130193147.279148-10-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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/stk8ba50.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index 517c57ed9e94..0067ec5cbae8 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -504,7 +504,6 @@ static int stk8ba50_remove(struct i2c_client *client)
 	return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stk8ba50_suspend(struct device *dev)
 {
 	struct stk8ba50_data *data;
@@ -523,12 +522,8 @@ static int stk8ba50_resume(struct device *dev)
 	return stk8ba50_set_power(data, STK8BA50_MODE_NORMAL);
 }
 
-static SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume);
-
-#define STK8BA50_PM_OPS (&stk8ba50_pm_ops)
-#else
-#define STK8BA50_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend,
+				stk8ba50_resume);
 
 static const struct i2c_device_id stk8ba50_i2c_id[] = {
 	{"stk8ba50", 0},
@@ -546,7 +541,7 @@ MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id);
 static struct i2c_driver stk8ba50_driver = {
 	.driver = {
 		.name = "stk8ba50",
-		.pm = STK8BA50_PM_OPS,
+		.pm = pm_sleep_ptr(&stk8ba50_pm_ops),
 		.acpi_match_table = ACPI_PTR(stk8ba50_acpi_id),
 	},
 	.probe =            stk8ba50_probe,
-- 
2.35.1


  parent reply	other threads:[~2022-01-30 19:26 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 ` Jonathan Cameron [this message]
2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc 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 ` [PATCH v3 35/50] iio:proximity:sx9500: " Jonathan Cameron
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-10-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.