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>,
	Gwendal Grignou <gwendal@chromium.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Manivannan Sadhasivam <mani@kernel.org>
Subject: [PATCH v2 44/51] iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Date: Sun,  2 Jan 2022 12:56:10 +0000	[thread overview]
Message-ID: <20220102125617.1259804-45-jic23@kernel.org> (raw)
In-Reply-To: <20220102125617.1259804-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>
Cc: Manivannan Sadhasivam <mani@kernel.org>
---
 drivers/iio/temperature/tmp007.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/temperature/tmp007.c b/drivers/iio/temperature/tmp007.c
index b422371a4674..f7a040f0ee4c 100644
--- a/drivers/iio/temperature/tmp007.c
+++ b/drivers/iio/temperature/tmp007.c
@@ -537,7 +537,6 @@ static int tmp007_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tmp007_suspend(struct device *dev)
 {
 	struct tmp007_data *data = iio_priv(i2c_get_clientdata(
@@ -554,9 +553,8 @@ static int tmp007_resume(struct device *dev)
 	return i2c_smbus_write_word_swapped(data->client, TMP007_CONFIG,
 			data->config | TMP007_CONFIG_CONV_EN);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);
+DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);
 
 static const struct of_device_id tmp007_of_match[] = {
 	{ .compatible = "ti,tmp007", },
@@ -574,7 +572,7 @@ static struct i2c_driver tmp007_driver = {
 	.driver = {
 		.name	= "tmp007",
 		.of_match_table = tmp007_of_match,
-		.pm	= &tmp007_pm_ops,
+		.pm	= pm_sleep_ptr(&tmp007_pm_ops),
 	},
 	.probe		= tmp007_probe,
 	.id_table	= tmp007_id,
-- 
2.34.1


  parent reply	other threads:[~2022-01-02 12: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 ` Jonathan Cameron [this message]
2022-01-03  6:03   ` [PATCH v2 44/51] iio:temperature:tmp007: " 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
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=20220102125617.1259804-45-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=mani@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.