[PATCH v2 08/30] mfd: rc5t583-irq: Remove #ifdef guards for PM related functions

From: Paul Cercueil
Date: Mon Aug 08 2022 - 13:43:27 EST


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.

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: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
---
drivers/mfd/rc5t583-irq.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c
index b374a3d34688..621ea61fa7c6 100644
--- a/drivers/mfd/rc5t583-irq.c
+++ b/drivers/mfd/rc5t583-irq.c
@@ -228,15 +228,12 @@ static void rc5t583_irq_sync_unlock(struct irq_data *irq_data)

mutex_unlock(&rc5t583->irq_lock);
}
-#ifdef CONFIG_PM_SLEEP
+
static int rc5t583_irq_set_wake(struct irq_data *irq_data, unsigned int on)
{
struct rc5t583 *rc5t583 = irq_data_get_irq_chip_data(irq_data);
return irq_set_irq_wake(rc5t583->chip_irq, on);
}
-#else
-#define rc5t583_irq_set_wake NULL
-#endif

static irqreturn_t rc5t583_irq(int irq, void *data)
{
@@ -317,7 +314,7 @@ static struct irq_chip rc5t583_irq_chip = {
.irq_bus_lock = rc5t583_irq_lock,
.irq_bus_sync_unlock = rc5t583_irq_sync_unlock,
.irq_set_type = rc5t583_irq_set_type,
- .irq_set_wake = rc5t583_irq_set_wake,
+ .irq_set_wake = pm_sleep_ptr(rc5t583_irq_set_wake),
};

int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
--
2.35.1