diff mbox series

[v2,1/4] pwm: sysfs: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220826170716.6886-1-andriy.shevchenko@linux.intel.com
State Accepted
Headers show
Series [v2,1/4] pwm: sysfs: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() | expand

Commit Message

Andy Shevchenko Aug. 26, 2022, 5:07 p.m. UTC
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(-)

Comments

Andy Shevchenko Sept. 6, 2022, 1:57 p.m. UTC | #1
On Fri, Aug 26, 2022 at 08:07:13PM +0300, Andy Shevchenko wrote:
> 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.

Anything I should have done for this to be applied?
Thierry Reding Sept. 28, 2022, 12:31 p.m. UTC | #2
On Fri, Aug 26, 2022 at 08:07:13PM +0300, Andy Shevchenko wrote:
> 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(-)

Applied, thanks.

Thierry
Andy Shevchenko Sept. 28, 2022, 2:01 p.m. UTC | #3
On Wed, Sep 28, 2022 at 02:31:45PM +0200, Thierry Reding wrote:
> On Fri, Aug 26, 2022 at 08:07:13PM +0300, Andy Shevchenko wrote:
> > 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.

> Applied, thanks.

Thanks and thank you for the review. It would be nice if you can check PWM LPSS
series [1] as well and another PWM related patch [2] I sent.

[1]: https://lore.kernel.org/linux-pwm/20220927162421.11052-1-andriy.shevchenko@linux.intel.com/
[2]: https://lore.kernel.org/linux-pwm/20220927172258.62418-1-andriy.shevchenko@linux.intel.com/
diff mbox series

Patch

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)