]> git.itanic.dy.fi Git - linux-stable/commitdiff
pwm: dwc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 23 Oct 2023 17:46:22 +0000 (19:46 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 20 Dec 2023 15:04:13 +0000 (16:04 +0100)
This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-dwc.c

index bd9cadb497d70e34b1b3eb974aa125bf6d44ab8d..4929354f8cd95c8b1bc37feccf4e92b3e541444c 100644 (file)
@@ -71,7 +71,6 @@ static void dwc_pwm_remove(struct pci_dev *pci)
        pm_runtime_get_noresume(&pci->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int dwc_pwm_suspend(struct device *dev)
 {
        struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
@@ -106,9 +105,8 @@ static int dwc_pwm_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume);
 
 static const struct pci_device_id dwc_pwm_id_table[] = {
        { PCI_VDEVICE(INTEL, 0x4bb7) }, /* Elkhart Lake */
@@ -122,7 +120,7 @@ static struct pci_driver dwc_pwm_driver = {
        .remove = dwc_pwm_remove,
        .id_table = dwc_pwm_id_table,
        .driver = {
-               .pm = &dwc_pwm_pm_ops,
+               .pm = pm_ptr(&dwc_pwm_pm_ops),
        },
 };