mirror of https://github.com/torvalds/linux.git
gpio: htc-egpio: 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> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Link: https://lore.kernel.org/r/20251124002105.25429-4-jszhang@kernel.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
56f3a6d753
commit
2557b1f4f2
|
|
@ -364,21 +364,20 @@ static int __init egpio_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int egpio_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
static int egpio_suspend(struct device *dev)
|
||||
{
|
||||
struct egpio_info *ei = platform_get_drvdata(pdev);
|
||||
struct egpio_info *ei = dev_get_drvdata(dev);
|
||||
|
||||
if (ei->chained_irq && device_may_wakeup(&pdev->dev))
|
||||
if (ei->chained_irq && device_may_wakeup(dev))
|
||||
enable_irq_wake(ei->chained_irq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int egpio_resume(struct platform_device *pdev)
|
||||
static int egpio_resume(struct device *dev)
|
||||
{
|
||||
struct egpio_info *ei = platform_get_drvdata(pdev);
|
||||
struct egpio_info *ei = dev_get_drvdata(dev);
|
||||
|
||||
if (ei->chained_irq && device_may_wakeup(&pdev->dev))
|
||||
if (ei->chained_irq && device_may_wakeup(dev))
|
||||
disable_irq_wake(ei->chained_irq);
|
||||
|
||||
/* Update registers from the cache, in case
|
||||
|
|
@ -386,19 +385,15 @@ static int egpio_resume(struct platform_device *pdev)
|
|||
egpio_write_cache(ei);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define egpio_suspend NULL
|
||||
#define egpio_resume NULL
|
||||
#endif
|
||||
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(egpio_pm_ops, egpio_suspend, egpio_resume);
|
||||
|
||||
static struct platform_driver egpio_driver = {
|
||||
.driver = {
|
||||
.name = "htc-egpio",
|
||||
.suppress_bind_attrs = true,
|
||||
.pm = pm_sleep_ptr(&egpio_pm_ops),
|
||||
},
|
||||
.suspend = egpio_suspend,
|
||||
.resume = egpio_resume,
|
||||
};
|
||||
|
||||
static int __init egpio_init(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue