mfd: rc5t583-irq: Remove #ifdef guards for PM related functions
authorPaul Cercueil <paul@crapouillou.net>
Sun, 23 Oct 2022 09:48:31 +0000 (10:48 +0100)
committerLee Jones <lee@kernel.org>
Wed, 7 Dec 2022 13:28:11 +0000 (13:28 +0000)
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@crapouillou.net>
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/rc5t583-irq.c

index b374a3d34688891e36eeea6c7f00508b9ab0a035..621ea61fa7c62983560c4ddca451f5ddbec3c5ad 100644 (file)
@@ -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)