All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org
Cc: "Paul Cercueil" <paul@crapouillou.net>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Roland Stigge" <stigge@antcom.de>,
	"Zoltán Kővágó" <dirty.ice.hu@gmail.com>,
	"Ninad Malwade" <nmalwade@nvidia.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: [PATCH 08/18] hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Date: Sun, 25 Sep 2022 18:27:49 +0100	[thread overview]
Message-ID: <20220925172759.3573439-9-jic23@kernel.org> (raw)
In-Reply-To: <20220925172759.3573439-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result. In this case it also lets the
structure itself be removed.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nuno Sá <nuno.sa@analog.com>
---
 drivers/hwmon/ltc2947-core.c | 7 +++----
 drivers/hwmon/ltc2947-i2c.c  | 2 +-
 drivers/hwmon/ltc2947-spi.c  | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/ltc2947-core.c b/drivers/hwmon/ltc2947-core.c
index 626f5bf2c9c7..7404e974762f 100644
--- a/drivers/hwmon/ltc2947-core.c
+++ b/drivers/hwmon/ltc2947-core.c
@@ -1120,7 +1120,7 @@ int ltc2947_core_probe(struct regmap *map, const char *name)
 }
 EXPORT_SYMBOL_GPL(ltc2947_core_probe);
 
-static int __maybe_unused ltc2947_resume(struct device *dev)
+static int ltc2947_resume(struct device *dev)
 {
 	struct ltc2947_data *st = dev_get_drvdata(dev);
 	u32 ctrl = 0;
@@ -1149,7 +1149,7 @@ static int __maybe_unused ltc2947_resume(struct device *dev)
 				  LTC2947_CONT_MODE_MASK, LTC2947_CONT_MODE(1));
 }
 
-static int __maybe_unused ltc2947_suspend(struct device *dev)
+static int ltc2947_suspend(struct device *dev)
 {
 	struct ltc2947_data *st = dev_get_drvdata(dev);
 
@@ -1157,8 +1157,7 @@ static int __maybe_unused ltc2947_suspend(struct device *dev)
 				  LTC2947_SHUTDOWN_MASK, 1);
 }
 
-SIMPLE_DEV_PM_OPS(ltc2947_pm_ops, ltc2947_suspend, ltc2947_resume);
-EXPORT_SYMBOL_GPL(ltc2947_pm_ops);
+EXPORT_SIMPLE_DEV_PM_OPS(ltc2947_pm_ops, ltc2947_suspend, ltc2947_resume);
 
 const struct of_device_id ltc2947_of_match[] = {
 	{ .compatible = "adi,ltc2947" },
diff --git a/drivers/hwmon/ltc2947-i2c.c b/drivers/hwmon/ltc2947-i2c.c
index ad0dfd3efbf8..96852bc8a964 100644
--- a/drivers/hwmon/ltc2947-i2c.c
+++ b/drivers/hwmon/ltc2947-i2c.c
@@ -36,7 +36,7 @@ static struct i2c_driver ltc2947_driver = {
 	.driver = {
 		.name = "ltc2947",
 		.of_match_table = ltc2947_of_match,
-		.pm = &ltc2947_pm_ops,
+		.pm = pm_sleep_ptr(&ltc2947_pm_ops),
 	},
 	.probe_new = ltc2947_probe,
 	.id_table = ltc2947_id,
diff --git a/drivers/hwmon/ltc2947-spi.c b/drivers/hwmon/ltc2947-spi.c
index c24ca569db1b..a33be110098c 100644
--- a/drivers/hwmon/ltc2947-spi.c
+++ b/drivers/hwmon/ltc2947-spi.c
@@ -38,7 +38,7 @@ static struct spi_driver ltc2947_driver = {
 	.driver = {
 		.name = "ltc2947",
 		.of_match_table = ltc2947_of_match,
-		.pm = &ltc2947_pm_ops,
+		.pm = pm_sleep_ptr(&ltc2947_pm_ops),
 	},
 	.probe = ltc2947_probe,
 	.id_table = ltc2947_id,
-- 
2.37.2


  parent reply	other threads:[~2022-09-25 17:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
2022-09-25 17:27 ` [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
2022-09-25 17:27 ` [PATCH 02/18] hwmon: (abitguru3) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 03/18] hwmon: (acpi_power_meter) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 04/18] hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 18:49   ` Guenter Roeck
2022-09-26  8:32     ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 06/18] hwmon: (it87) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 07/18] hwmon: (lm90) " Jonathan Cameron
2022-09-25 17:27 ` Jonathan Cameron [this message]
2022-09-25 17:27 ` [PATCH 09/18] hwmon: (max31722) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 10/18] hwmon: (max31730) witch " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 11/18] hwmon: (max6639) Switch " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 12/18] hwmon: (nct6775) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 13/18] hwmon: (pwm-fan) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 14/18] hwmon: (tmp102) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 15/18] hwmon: (tmp103) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 16/18] hwmon: (tmp108) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 17/18] hwmon: (w83627ehf) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 18/18] hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Jonathan Cameron
2022-09-25 17:47 ` [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Guenter Roeck

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=20220925172759.3573439-9-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=dirty.ice.hu@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jdelvare@suse.com \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nmalwade@nvidia.com \
    --cc=nuno.sa@analog.com \
    --cc=paul@crapouillou.net \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stigge@antcom.de \
    /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.