linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] pwm: sysfs: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
@ 2022-08-26 17:07 Andy Shevchenko
  2022-08-26 17:07 ` [PATCH v2 2/4] pwm: sysfs: Return directly from the for-loop in PM callbacks Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Andy Shevchenko @ 2022-08-26 17:07 UTC (permalink / raw)
  To: Andy Shevchenko, linux-pwm, linux-kernel
  Cc: Thierry Reding, Uwe Kleine-König

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
v2: added tag (Uwe)
 drivers/pwm/sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index 9903c3a7eced..c21b6046067b 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -433,7 +433,7 @@ static int pwm_class_resume_npwm(struct device *parent, unsigned int npwm)
 	return ret;
 }
 
-static int __maybe_unused pwm_class_suspend(struct device *parent)
+static int pwm_class_suspend(struct device *parent)
 {
 	struct pwm_chip *chip = dev_get_drvdata(parent);
 	unsigned int i;
@@ -464,20 +464,20 @@ static int __maybe_unused pwm_class_suspend(struct device *parent)
 	return ret;
 }
 
-static int __maybe_unused pwm_class_resume(struct device *parent)
+static int pwm_class_resume(struct device *parent)
 {
 	struct pwm_chip *chip = dev_get_drvdata(parent);
 
 	return pwm_class_resume_npwm(parent, chip->npwm);
 }
 
-static SIMPLE_DEV_PM_OPS(pwm_class_pm_ops, pwm_class_suspend, pwm_class_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pwm_class_pm_ops, pwm_class_suspend, pwm_class_resume);
 
 static struct class pwm_class = {
 	.name = "pwm",
 	.owner = THIS_MODULE,
 	.dev_groups = pwm_chip_groups,
-	.pm = &pwm_class_pm_ops,
+	.pm = pm_sleep_ptr(&pwm_class_pm_ops),
 };
 
 static int pwmchip_sysfs_match(struct device *parent, const void *data)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-09-28 15:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 17:07 [PATCH v2 1/4] pwm: sysfs: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Andy Shevchenko
2022-08-26 17:07 ` [PATCH v2 2/4] pwm: sysfs: Return directly from the for-loop in PM callbacks Andy Shevchenko
2022-09-28 12:31   ` Thierry Reding
2022-09-28 13:43     ` Andy Shevchenko
2022-08-26 17:07 ` [PATCH v2 3/4] pwm: sysfs: Replace sprintf() with sysfs_emit() Andy Shevchenko
2022-09-28 12:28   ` Thierry Reding
2022-09-28 13:40     ` Andy Shevchenko
2022-09-28 13:58       ` Andy Shevchenko
2022-09-28 15:20         ` Thierry Reding
2022-09-28 15:21           ` Thierry Reding
2022-09-28 15:39           ` Andy Shevchenko
2022-08-26 17:07 ` [PATCH v2 4/4] pwm: sysfs: Utilize an array for polarity strings Andy Shevchenko
2022-08-28  2:07   ` Joe Perches
     [not found]     ` <CAHp75VfY5RgAju5ASvAp565oF6VmYYiuowNsPTGSm=+1iFJ98A@mail.gmail.com>
2022-08-28 13:46       ` Joe Perches
2022-08-28 17:40         ` Andy Shevchenko
2022-08-28 18:19           ` Joe Perches
2022-08-29  7:59             ` Andy Shevchenko
2022-09-28 12:15             ` Thierry Reding
2022-09-06 13:57 ` [PATCH v2 1/4] pwm: sysfs: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Andy Shevchenko
2022-09-28 12:31 ` Thierry Reding
2022-09-28 14:01   ` Andy Shevchenko

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).