[PATCH 05/28] mfd: mt6397-irq: Remove #ifdef guards for PM related functions
Paul Cercueil
paul at crapouillou.net
Sun Aug 7 07:52:24 PDT 2022
Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback.
This macro allows the mt6397_irq_set_wake() function to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.
The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.
Signed-off-by: Paul Cercueil <paul at crapouillou.net>
Cc: Matthias Brugger <matthias.bgg at gmail.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-mediatek at lists.infradead.org
---
drivers/mfd/mt6397-irq.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mfd/mt6397-irq.c b/drivers/mfd/mt6397-irq.c
index 2924919da991..69009d119216 100644
--- a/drivers/mfd/mt6397-irq.c
+++ b/drivers/mfd/mt6397-irq.c
@@ -52,7 +52,6 @@ static void mt6397_irq_enable(struct irq_data *data)
mt6397->irq_masks_cur[reg] |= BIT(shift);
}
-#ifdef CONFIG_PM_SLEEP
static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
{
struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data);
@@ -66,9 +65,6 @@ static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
return 0;
}
-#else
-#define mt6397_irq_set_wake NULL
-#endif
static struct irq_chip mt6397_irq_chip = {
.name = "mt6397-irq",
@@ -76,7 +72,7 @@ static struct irq_chip mt6397_irq_chip = {
.irq_bus_sync_unlock = mt6397_irq_sync_unlock,
.irq_enable = mt6397_irq_enable,
.irq_disable = mt6397_irq_disable,
- .irq_set_wake = mt6397_irq_set_wake,
+ .irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake),
};
static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg,
--
2.35.1
More information about the Linux-mediatek
mailing list