[PATCH v2 6/9] pwm: lpss: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros

Andy Shevchenko posted 9 patches 3 years, 6 months ago
There is a newer version of this series
[PATCH v2 6/9] pwm: lpss: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
Posted by Andy Shevchenko 3 years, 6 months ago
Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pwm/pwm-lpss-pci.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pwm/pwm-lpss-pci.c b/drivers/pwm/pwm-lpss-pci.c
index f3367e844e61..98413d364338 100644
--- a/drivers/pwm/pwm-lpss-pci.c
+++ b/drivers/pwm/pwm-lpss-pci.c
@@ -48,7 +48,6 @@ static void pwm_lpss_remove_pci(struct pci_dev *pdev)
 	pm_runtime_get_sync(&pdev->dev);
 }
 
-#ifdef CONFIG_PM
 static int pwm_lpss_runtime_suspend_pci(struct device *dev)
 {
 	/*
@@ -62,12 +61,11 @@ static int pwm_lpss_runtime_resume_pci(struct device *dev)
 {
 	return 0;
 }
-#endif
 
-static const struct dev_pm_ops pwm_lpss_pci_pm = {
-	SET_RUNTIME_PM_OPS(pwm_lpss_runtime_suspend_pci,
-			   pwm_lpss_runtime_resume_pci, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(pwm_lpss_pci_pm,
+				 pwm_lpss_runtime_suspend_pci,
+				 pwm_lpss_runtime_resume_pci,
+				 NULL);
 
 static const struct pci_device_id pwm_lpss_pci_ids[] = {
 	{ PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info},
@@ -89,7 +87,7 @@ static struct pci_driver pwm_lpss_driver_pci = {
 	.probe = pwm_lpss_probe_pci,
 	.remove = pwm_lpss_remove_pci,
 	.driver = {
-		.pm = &pwm_lpss_pci_pm,
+		.pm = pm_ptr(&pwm_lpss_pci_pm),
 	},
 };
 module_pci_driver(pwm_lpss_driver_pci);
-- 
2.35.1
Re: [PATCH v2 6/9] pwm: lpss: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
Posted by Uwe Kleine-König 3 years, 6 months ago
On Thu, Sep 08, 2022 at 04:56:55PM +0300, Andy Shevchenko wrote:
> Using these new macros allows the compiler to remove the unused dev_pm_ops
> structure and related functions if !CONFIG_PM without the need to mark
> the functions __maybe_unused.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

that was one of the patches I thought I already acked. I didn't check if
I'm confused or if you missed to add my Ack. Doesn't really matter to
me. So:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PATCH v2 6/9] pwm: lpss: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
Posted by Andy Shevchenko 3 years, 6 months ago
On Sat, Sep 24, 2022 at 12:07:14PM +0200, Uwe Kleine-König wrote:
> On Thu, Sep 08, 2022 at 04:56:55PM +0300, Andy Shevchenko wrote:
> > Using these new macros allows the compiler to remove the unused dev_pm_ops
> > structure and related functions if !CONFIG_PM without the need to mark
> > the functions __maybe_unused.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> that was one of the patches I thought I already acked. I didn't check if
> I'm confused or if you missed to add my Ack.

If so, sorry, and I think it might be because of wrong branch I took or misuse
of `git filter-branch --msg-filter`... But looking into [1] I do not see your
replies.

[1]: https://lore.kernel.org/linux-pwm/20220906195735.87361-1-andriy.shevchenko@linux.intel.com/

> Doesn't really matter to
> me. So:
> 
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks!

-- 
With Best Regards,
Andy Shevchenko