Skip to content

Commit 56f3a6d

Browse files
xhackerustcBartosz Golaszewski
authored andcommitted
gpio: brcmstb: Use modern PM macros
Use the modern PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Acked-by: Doug Berger <opendmb@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20251124002105.25429-3-jszhang@kernel.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 3f19e57 commit 56f3a6d

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

drivers/gpio/gpio-brcmstb.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ static void brcmstb_gpio_shutdown(struct platform_device *pdev)
533533
brcmstb_gpio_quiesce(&pdev->dev, false);
534534
}
535535

536-
#ifdef CONFIG_PM_SLEEP
537536
static void brcmstb_gpio_bank_restore(struct brcmstb_gpio_priv *priv,
538537
struct brcmstb_gpio_bank *bank)
539538
{
@@ -572,14 +571,9 @@ static int brcmstb_gpio_resume(struct device *dev)
572571
return 0;
573572
}
574573

575-
#else
576-
#define brcmstb_gpio_suspend NULL
577-
#define brcmstb_gpio_resume NULL
578-
#endif /* CONFIG_PM_SLEEP */
579-
580574
static const struct dev_pm_ops brcmstb_gpio_pm_ops = {
581-
.suspend_noirq = brcmstb_gpio_suspend,
582-
.resume_noirq = brcmstb_gpio_resume,
575+
.suspend_noirq = pm_sleep_ptr(brcmstb_gpio_suspend),
576+
.resume_noirq = pm_sleep_ptr(brcmstb_gpio_resume),
583577
};
584578

585579
static int brcmstb_gpio_probe(struct platform_device *pdev)
@@ -755,7 +749,7 @@ static struct platform_driver brcmstb_gpio_driver = {
755749
.driver = {
756750
.name = "brcmstb-gpio",
757751
.of_match_table = brcmstb_gpio_of_match,
758-
.pm = &brcmstb_gpio_pm_ops,
752+
.pm = pm_sleep_ptr(&brcmstb_gpio_pm_ops),
759753
},
760754
.probe = brcmstb_gpio_probe,
761755
.remove = brcmstb_gpio_remove,

0 commit comments

Comments
 (0)