mirror of https://github.com/torvalds/linux.git
gpio: dwapb: 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: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Link: https://lore.kernel.org/r/20251124002105.25429-2-jszhang@kernel.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
4cfe6cdba5
commit
3f19e57cbf
|
|
@ -79,7 +79,6 @@ struct dwapb_platform_data {
|
|||
unsigned int nports;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
/* Store GPIO context across system-wide suspend/resume transitions */
|
||||
struct dwapb_context {
|
||||
u32 data;
|
||||
|
|
@ -92,7 +91,6 @@ struct dwapb_context {
|
|||
u32 int_deb;
|
||||
u32 wake_en;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct dwapb_gpio_port_irqchip {
|
||||
unsigned int nr_irqs;
|
||||
|
|
@ -103,9 +101,7 @@ struct dwapb_gpio_port {
|
|||
struct gpio_generic_chip chip;
|
||||
struct dwapb_gpio_port_irqchip *pirq;
|
||||
struct dwapb_gpio *gpio;
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
struct dwapb_context *ctx;
|
||||
#endif
|
||||
unsigned int idx;
|
||||
};
|
||||
|
||||
|
|
@ -363,7 +359,6 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
|
|
@ -378,9 +373,6 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define dwapb_irq_set_wake NULL
|
||||
#endif
|
||||
|
||||
static const struct irq_chip dwapb_irq_chip = {
|
||||
.name = DWAPB_DRIVER_NAME,
|
||||
|
|
@ -390,7 +382,7 @@ static const struct irq_chip dwapb_irq_chip = {
|
|||
.irq_set_type = dwapb_irq_set_type,
|
||||
.irq_enable = dwapb_irq_enable,
|
||||
.irq_disable = dwapb_irq_disable,
|
||||
.irq_set_wake = dwapb_irq_set_wake,
|
||||
.irq_set_wake = pm_sleep_ptr(dwapb_irq_set_wake),
|
||||
.flags = IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
|
@ -759,7 +751,6 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int dwapb_gpio_suspend(struct device *dev)
|
||||
{
|
||||
struct dwapb_gpio *gpio = dev_get_drvdata(dev);
|
||||
|
|
@ -844,15 +835,14 @@ static int dwapb_gpio_resume(struct device *dev)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, dwapb_gpio_suspend,
|
||||
dwapb_gpio_resume);
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops,
|
||||
dwapb_gpio_suspend, dwapb_gpio_resume);
|
||||
|
||||
static struct platform_driver dwapb_gpio_driver = {
|
||||
.driver = {
|
||||
.name = DWAPB_DRIVER_NAME,
|
||||
.pm = &dwapb_gpio_pm_ops,
|
||||
.pm = pm_sleep_ptr(&dwapb_gpio_pm_ops),
|
||||
.of_match_table = dwapb_of_match,
|
||||
.acpi_match_table = dwapb_acpi_match,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue