From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33271C19F2A for ; Sun, 7 Aug 2022 14:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234018AbiHGOxS (ORCPT ); Sun, 7 Aug 2022 10:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234156AbiHGOxP (ORCPT ); Sun, 7 Aug 2022 10:53:15 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D071A448 for ; Sun, 7 Aug 2022 07:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883980; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DG90t3myM/UGW+Xa4zE2jhg4qZfAFetzVaKv0EyBt5w=; b=xSgds//oJREwk0y54hRaPWujH58h/mIN9nKdMcCd4zzTpOYHNTAgtLPs8WS/azFsbtkowB ot7MpzjEddeXTO9YQryQw8zgjIDNefT4nxnOAYs2hLUbtkPwP1/3vW1tfXFG+/iAdoY29a Na9Zl6HXwLxs+s8SDQqAl34CPOrmZCk= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 01/28] mfd: 88pm80x: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:20 +0200 Message-Id: <20220807145247.46107-2-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/88pm800.c | 2 +- drivers/mfd/88pm805.c | 2 +- drivers/mfd/88pm80x.c | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index eaf9845633b4..409f0996ae1d 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -599,7 +599,7 @@ static int pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver =3D { .driver =3D { .name =3D "88PM800", - .pm =3D &pm80x_pm_ops, + .pm =3D pm_sleep_ptr(&pm80x_pm_ops), }, .probe =3D pm800_probe, .remove =3D pm800_remove, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index ada6c513302b..724ac4947e6f 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -254,7 +254,7 @@ static int pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver =3D { .driver =3D { .name =3D "88PM805", - .pm =3D &pm80x_pm_ops, + .pm =3D pm_sleep_ptr(&pm80x_pm_ops), }, .probe =3D pm805_probe, .remove =3D pm805_remove, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index be036e7e787b..ac4f08565f29 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -129,7 +129,6 @@ int pm80x_deinit(void) } EXPORT_SYMBOL_GPL(pm80x_deinit); =20 -#ifdef CONFIG_PM_SLEEP static int pm80x_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev) =20 return 0; } -#endif =20 -SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); -EXPORT_SYMBOL_GPL(pm80x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); =20 MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); MODULE_AUTHOR("Qiao Zhou "); --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50186C19F2A for ; Sun, 7 Aug 2022 14:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234305AbiHGOxZ (ORCPT ); Sun, 7 Aug 2022 10:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234291AbiHGOxW (ORCPT ); Sun, 7 Aug 2022 10:53:22 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E60FA195 for ; Sun, 7 Aug 2022 07:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883981; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jeDp4mkUztMMW1RvCNc9votvIoNVltLlfIbqBqy6Kj4=; b=RBAPFh9HvvXfNJe6C6hZdpNhVlhe3iAP4MZ+Pi3Q+gDHUQeapWyQGsC2Dmc4qiPMHNkRgN 3LrjKiKk/usE2szw15tYNV+qY4+3hdtNDQAvQxPCHuD/KrEjBmlTKtnGMzNGNps4crJOj7 Nb+DZXJmWR+xVjG61nBYkhl2IuY+OBg= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:21 +0200 Message-Id: <20220807145247.46107-3-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/aat2870-core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index a17cf759739d..8a3967c3f026 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -409,7 +409,6 @@ static int aat2870_i2c_probe(struct i2c_client *client, return ret; } =20 -#ifdef CONFIG_PM_SLEEP static int aat2870_i2c_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -438,10 +437,9 @@ static int aat2870_i2c_resume(struct device *dev) =20 return 0; } -#endif /* CONFIG_PM_SLEEP */ =20 -static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, - aat2870_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, + aat2870_i2c_resume); =20 static const struct i2c_device_id aat2870_i2c_id_table[] =3D { { "aat2870", 0 }, @@ -451,7 +449,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[= ] =3D { static struct i2c_driver aat2870_i2c_driver =3D { .driver =3D { .name =3D "aat2870", - .pm =3D &aat2870_pm_ops, + .pm =3D pm_sleep_ptr(&aat2870_pm_ops), .suppress_bind_attrs =3D true, }, .probe =3D aat2870_i2c_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 647B9C19F2A for ; Sun, 7 Aug 2022 14:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234336AbiHGOxg (ORCPT ); Sun, 7 Aug 2022 10:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234367AbiHGOxb (ORCPT ); Sun, 7 Aug 2022 10:53:31 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BB4A1A8 for ; Sun, 7 Aug 2022 07:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883981; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V5V+oAmei+VoJpSQsI4DtJbnHY6ZS38K62z7aM+1CLQ=; b=BbMvtcabDa/hf0PTcgFuLNu4baYDw0jjVdz5Y2fQ8wH6cHvdnFsrqQjaeWE3XY61r+BhGy dVWaic3z554J7QsWcuriQVsz6bp5n+aHG2X4owEL117upoiJ8Dg9XbJvGSjNZCIEtYq4+O zBY2jgseo5kLVJCu5cJgHFyygATFraY= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Michael Hennerich Subject: [PATCH 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:22 +0200 Message-Id: <20220807145247.46107-4-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Michael Hennerich Acked-by: Michael Hennerich --- drivers/mfd/adp5520.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index 8db15f5a7179..882eddc32f8e 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c @@ -305,7 +305,6 @@ static int adp5520_probe(struct i2c_client *client, return ret; } =20 -#ifdef CONFIG_PM_SLEEP static int adp5520_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -326,9 +325,8 @@ static int adp5520_resume(struct device *dev) adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode); return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resum= e); =20 static const struct i2c_device_id adp5520_id[] =3D { { "pmic-adp5520", ID_ADP5520 }, @@ -339,7 +337,7 @@ static const struct i2c_device_id adp5520_id[] =3D { static struct i2c_driver adp5520_driver =3D { .driver =3D { .name =3D "adp5520", - .pm =3D &adp5520_pm, + .pm =3D pm_sleep_ptr(&adp5520_pm), .suppress_bind_attrs =3D true, }, .probe =3D adp5520_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FE1CC19F2A for ; Sun, 7 Aug 2022 14:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234334AbiHGOxt (ORCPT ); Sun, 7 Aug 2022 10:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234414AbiHGOxm (ORCPT ); Sun, 7 Aug 2022 10:53:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB205A461 for ; Sun, 7 Aug 2022 07:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883981; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kpn39KorDFOqH9PIAfsq4TNql93fwh4pKumyo2NZK3k=; b=bQa3hvVg2oiDma8ImHf+Rl0gUDoBzKonkQtuZDhzsawMMZDwWchTyglysi6ZzqLodaoiUU hae1zID3mHBIeX2YXhOycUcIPHSPsJEAFslAHEnoYxlc7XzNGe5B562ggPF75kjOmmoOBI 0iHUf7TvE91ucKOirUI2p7f3iNTjzDQ= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 04/28] mfd: max8925-i2c: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:23 +0200 Message-Id: <20220807145247.46107-5-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/max8925-i2c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index 114e905bef25..649310b5bb3e 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c @@ -208,7 +208,6 @@ static int max8925_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int max8925_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -228,9 +227,9 @@ static int max8925_resume(struct device *dev) disable_irq_wake(chip->core_irq); return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops, + max8925_suspend, max8925_resume); =20 static const struct of_device_id max8925_dt_ids[] =3D { { .compatible =3D "maxim,max8925", }, @@ -240,7 +239,7 @@ static const struct of_device_id max8925_dt_ids[] =3D { static struct i2c_driver max8925_driver =3D { .driver =3D { .name =3D "max8925", - .pm =3D &max8925_pm_ops, + .pm =3D pm_sleep_ptr(&max8925_pm_ops), .of_match_table =3D max8925_dt_ids, }, .probe =3D max8925_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2561C19F2A for ; Sun, 7 Aug 2022 14:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234322AbiHGOx4 (ORCPT ); Sun, 7 Aug 2022 10:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234397AbiHGOxt (ORCPT ); Sun, 7 Aug 2022 10:53:49 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07263A44A for ; Sun, 7 Aug 2022 07:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883982; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=31kG5gjhviHwLsXux6Sn6owRjNJeuuOaVC6064XnvhM=; b=4RybMQjmOajH4LdLvd0aKYxNZvWQsWxpaRt1gNatYx4FW2YUt05DgcNXYmvIlHZhmkE7fd 7HTCIOyEYtrHUbzxj352yIJ0tHmPkCZOabH8bbSQo5Wsbn+Ll12k/KAjPrl6gg4olcnSnO cIBQShE9MMRoiNOWlHyECVB888XgzQQ= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 05/28] mfd: mt6397-irq: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:24 +0200 Message-Id: <20220807145247.46107-6-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Cc: Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@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] |=3D BIT(shift); } =20 -#ifdef CONFIG_PM_SLEEP static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) { struct mt6397_chip *mt6397 =3D 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) =20 return 0; } -#else -#define mt6397_irq_set_wake NULL -#endif =20 static struct irq_chip mt6397_irq_chip =3D { .name =3D "mt6397-irq", @@ -76,7 +72,7 @@ static struct irq_chip mt6397_irq_chip =3D { .irq_bus_sync_unlock =3D mt6397_irq_sync_unlock, .irq_enable =3D mt6397_irq_enable, .irq_disable =3D mt6397_irq_disable, - .irq_set_wake =3D mt6397_irq_set_wake, + .irq_set_wake =3D pm_sleep_ptr(mt6397_irq_set_wake), }; =20 static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8437FC19F2A for ; Sun, 7 Aug 2022 14:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234486AbiHGOyA (ORCPT ); Sun, 7 Aug 2022 10:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234454AbiHGOx4 (ORCPT ); Sun, 7 Aug 2022 10:53:56 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983C1A1BE for ; Sun, 7 Aug 2022 07:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883982; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Eji1stNn7t9g0rNZe1kSDcVA5NkcySHASxIK2JDxb8=; b=Vf/5CdHiXEmcznfxOqVnjN+tvxeMk/IvXL/QUu37H3pnlnpHrfwzUI+zNeZIfk3GXpjmk/ Eb149dn1j6IbVvRmrR8kgNDcW3DHq1GUP+JYp7l7By+aTorVaAhtIcgZnMa3dWvt12Sg01 kTIdwJLQ726Lvq9Xdkh1H5omZnQs17I= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 06/28] mfd: pcf50633: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:25 +0200 Message-Id: <20220807145247.46107-7-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/pcf50633-core.c | 22 +--------------------- drivers/mfd/pcf50633-irq.c | 13 ++++++++----- include/linux/mfd/pcf50633/core.h | 6 ++---- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index e9c565cf0f54..06d750d9a476 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c @@ -158,26 +158,6 @@ pcf50633_client_dev_register(struct pcf50633 *pcf, con= st char *name, } } =20 -#ifdef CONFIG_PM_SLEEP -static int pcf50633_suspend(struct device *dev) -{ - struct i2c_client *client =3D to_i2c_client(dev); - struct pcf50633 *pcf =3D i2c_get_clientdata(client); - - return pcf50633_irq_suspend(pcf); -} - -static int pcf50633_resume(struct device *dev) -{ - struct i2c_client *client =3D to_i2c_client(dev); - struct pcf50633 *pcf =3D i2c_get_clientdata(client); - - return pcf50633_irq_resume(pcf); -} -#endif - -static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); - static const struct regmap_config pcf50633_regmap_config =3D { .reg_bits =3D 8, .val_bits =3D 8, @@ -302,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table); static struct i2c_driver pcf50633_driver =3D { .driver =3D { .name =3D "pcf50633", - .pm =3D &pcf50633_pm, + .pm =3D pm_sleep_ptr(&pcf50633_pm), }, .id_table =3D pcf50633_id_table, .probe =3D pcf50633_probe, diff --git a/drivers/mfd/pcf50633-irq.c b/drivers/mfd/pcf50633-irq.c index 2096afb0ce9b..e85af7f1cb0b 100644 --- a/drivers/mfd/pcf50633-irq.c +++ b/drivers/mfd/pcf50633-irq.c @@ -7,6 +7,7 @@ * All rights reserved. */ =20 +#include #include #include #include @@ -218,10 +219,10 @@ static irqreturn_t pcf50633_irq(int irq, void *data) return IRQ_HANDLED; } =20 -#ifdef CONFIG_PM - -int pcf50633_irq_suspend(struct pcf50633 *pcf) +static int pcf50633_suspend(struct device *dev) { + struct i2c_client *client =3D to_i2c_client(dev); + struct pcf50633 *pcf =3D i2c_get_clientdata(client); int ret; int i; u8 res[5]; @@ -257,8 +258,10 @@ int pcf50633_irq_suspend(struct pcf50633 *pcf) return ret; } =20 -int pcf50633_irq_resume(struct pcf50633 *pcf) +static int pcf50633_resume(struct device *dev) { + struct i2c_client *client =3D to_i2c_client(dev); + struct pcf50633 *pcf =3D i2c_get_clientdata(client); int ret; =20 /* Write the saved mask registers */ @@ -273,7 +276,7 @@ int pcf50633_irq_resume(struct pcf50633 *pcf) return ret; } =20 -#endif +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resum= e); =20 int pcf50633_irq_init(struct pcf50633 *pcf, int irq) { diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633= /core.h index 3f752dc62a6c..539f27f8bd89 100644 --- a/include/linux/mfd/pcf50633/core.h +++ b/include/linux/mfd/pcf50633/core.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include =20 @@ -226,9 +227,6 @@ static inline struct pcf50633 *dev_to_pcf50633(struct d= evice *dev) =20 int pcf50633_irq_init(struct pcf50633 *pcf, int irq); void pcf50633_irq_free(struct pcf50633 *pcf); -#ifdef CONFIG_PM -int pcf50633_irq_suspend(struct pcf50633 *pcf); -int pcf50633_irq_resume(struct pcf50633 *pcf); -#endif +extern const struct dev_pm_ops pcf50633_pm; =20 #endif --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91379C19F2A for ; Sun, 7 Aug 2022 14:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234659AbiHGOyP (ORCPT ); Sun, 7 Aug 2022 10:54:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234533AbiHGOyE (ORCPT ); Sun, 7 Aug 2022 10:54:04 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3194A448 for ; Sun, 7 Aug 2022 07:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883982; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zKDUDti/hZ3PxARgvGF89r8lc6r7+qHkg0Rvd+HUJiI=; b=md08VqTrOw/MRmmT08lYBeBn0cPjO8n1T3NfMPrc4aGOjukGW4MvhesjSmmIVU3CRPAXh8 WrxRkBozzvX4L1+lWYuT1JdqX3MHb1ngMXQWpQsPq/jldHXzkYop4hZcAvUV6Ac6H2czth uupPUFbKF1+RKrh7YEZdvHE1KVpwfFw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 07/28] mfd: rc5t583-irq: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:26 +0200 Message-Id: <20220807145247.46107-8-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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) =20 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 =3D 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 =20 static irqreturn_t rc5t583_irq(int irq, void *data) { @@ -317,7 +314,7 @@ static struct irq_chip rc5t583_irq_chip =3D { .irq_bus_lock =3D rc5t583_irq_lock, .irq_bus_sync_unlock =3D rc5t583_irq_sync_unlock, .irq_set_type =3D rc5t583_irq_set_type, - .irq_set_wake =3D rc5t583_irq_set_wake, + .irq_set_wake =3D pm_sleep_ptr(rc5t583_irq_set_wake), }; =20 int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base) --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C980C19F2A for ; Sun, 7 Aug 2022 14:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234678AbiHGOyZ (ORCPT ); Sun, 7 Aug 2022 10:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234636AbiHGOyM (ORCPT ); Sun, 7 Aug 2022 10:54:12 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2679DAE4A for ; Sun, 7 Aug 2022 07:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883983; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6u2SIaffd3f7960zDNLsyNem/Dn7gkj0HJTBKauWpVY=; b=HLvx3q/e/SrTBpCCaSkYkNwIv5VifzhfF/5i6kczy6q1HLoNoJGqQQIhx30plqQPIg5fiQ Qk7c1jsopLP39uBDlGJyoE2Trjphrimfurb01moIv0V4q02YApSjkj+SOte3Ou9ClPPOjJ zQ4HseXvox/YdMDOMQMCByBV95WKXwI= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 08/28] mfd: stpmic1: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:27 +0200 Message-Id: <20220807145247.46107-9-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/stpmic1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c index eb3da558c3fb..7d8b0c0548fe 100644 --- a/drivers/mfd/stpmic1.c +++ b/drivers/mfd/stpmic1.c @@ -162,7 +162,6 @@ static int stpmic1_probe(struct i2c_client *i2c, return devm_of_platform_populate(dev); } =20 -#ifdef CONFIG_PM_SLEEP static int stpmic1_suspend(struct device *dev) { struct i2c_client *i2c =3D to_i2c_client(dev); @@ -187,9 +186,8 @@ static int stpmic1_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resum= e); =20 static const struct of_device_id stpmic1_of_match[] =3D { { .compatible =3D "st,stpmic1", }, @@ -201,7 +199,7 @@ static struct i2c_driver stpmic1_driver =3D { .driver =3D { .name =3D "stpmic1", .of_match_table =3D of_match_ptr(stpmic1_of_match), - .pm =3D &stpmic1_pm, + .pm =3D pm_sleep_ptr(&stpmic1_pm), }, .probe =3D stpmic1_probe, }; --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D59C19F2A for ; Sun, 7 Aug 2022 14:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234610AbiHGOy1 (ORCPT ); Sun, 7 Aug 2022 10:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234605AbiHGOyU (ORCPT ); Sun, 7 Aug 2022 10:54:20 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4199AAE68 for ; Sun, 7 Aug 2022 07:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883983; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9EEjxCxLicj8lTr6QCkk7V2VA0JvsqtxcXWH+ZhahwI=; b=c5LvvzDrwTynPBgZJl9rxPixvuEHUAEGLiuvYtoPsYMYez88X0fjE1fQ92PIPiaHEcp26z qju+KtrhzjTZ8+UMcDvLYhIfLh1cLdFnvFgPG9KeWmXQuCIsKUIcWL5R0U+yHFfESB61++ AxFnGgRO9BjkXkGrmoa/apGMagQIop0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 09/28] mfd: ucb1x00: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:28 +0200 Message-Id: <20220807145247.46107-10-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/ucb1x00-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index b690796d24d4..fc4d4c844a81 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -660,7 +660,6 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *d= rv) mutex_unlock(&ucb1x00_mutex); } =20 -#ifdef CONFIG_PM_SLEEP static int ucb1x00_suspend(struct device *dev) { struct ucb1x00_plat_data *pdata =3D dev_get_platdata(dev); @@ -728,15 +727,15 @@ static int ucb1x00_resume(struct device *dev) mutex_unlock(&ucb1x00_mutex); return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, ucb1x00_suspend, ucb1x00_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, + ucb1x00_suspend, ucb1x00_resume); =20 static struct mcp_driver ucb1x00_driver =3D { .drv =3D { .name =3D "ucb1x00", .owner =3D THIS_MODULE, - .pm =3D &ucb1x00_pm_ops, + .pm =3D pm_sleep_ptr(&ucb1x00_pm_ops), }, .probe =3D ucb1x00_probe, .remove =3D ucb1x00_remove, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D52AC19F2A for ; Sun, 7 Aug 2022 14:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234064AbiHGOyh (ORCPT ); Sun, 7 Aug 2022 10:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234605AbiHGOy2 (ORCPT ); Sun, 7 Aug 2022 10:54:28 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 236D2A44F for ; Sun, 7 Aug 2022 07:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883984; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zivyqjaFb3lN9q7sTz12f3Tu+aS6HnGvY6D+6Lvk5sU=; b=nq/Ds5o++VNAL8NNvIP0YMstGy8lfFtXMEs+XR8eCrK3x3wkEWr98v1l9BwFeqbdRZ51Wu XyJIFrP3KF08UXCY2MUba7HhM1FCWlw4lXGM8WR4lJ2KyIepn1vzi8LzCfch8AvCs+hWTa BXgQPwHvObAmZvlOTeYl2txj2mGwD3c= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 10/28] mfd: 88pm860x: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:29 +0200 Message-Id: <20220807145247.46107-11-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/88pm860x-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index b1e829ea909b..b698eb59041e 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1213,7 +1213,6 @@ static int pm860x_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int pm860x_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -1233,9 +1232,8 @@ static int pm860x_resume(struct device *dev) disable_irq_wake(chip->core_irq); return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resu= me); =20 static const struct i2c_device_id pm860x_id_table[] =3D { { "88PM860x", 0 }, @@ -1252,7 +1250,7 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids); static struct i2c_driver pm860x_driver =3D { .driver =3D { .name =3D "88PM860x", - .pm =3D &pm860x_pm_ops, + .pm =3D pm_sleep_ptr(&pm860x_pm_ops), .of_match_table =3D pm860x_dt_ids, }, .probe_new =3D pm860x_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 750C8C19F2A for ; Sun, 7 Aug 2022 14:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234526AbiHGOyn (ORCPT ); Sun, 7 Aug 2022 10:54:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234671AbiHGOyg (ORCPT ); Sun, 7 Aug 2022 10:54:36 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C361BAE44 for ; Sun, 7 Aug 2022 07:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883984; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m0jy5GL2jcyHt/0fssuM/k0AGfDYo0++8BhJmUjKUqw=; b=W0OW4Y7Rq/zb41lyviUJVHp6eOn8he7byoIwKRvgzbY/vwA8uP2kvdolTc1BD70N1Bgo/K miJFfo0O34am+a6bFBVV9wmqzNap87T9GiQJSvqXwl0GoF6kYeTlp/zNGfeuID7xluaHOY CB8cmMryySVV3+aqAwZyA3v/Hq0E46Q= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Andy Shevchenko Subject: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:30 +0200 Message-Id: <20220807145247.46107-12-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Andy Shevchenko --- drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +++---- drivers/mfd/intel_soc_pmic_core.c | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmi= c_bxtwc.c index bc069c4daa60..7110d91f7ace 100644 --- a/drivers/mfd/intel_soc_pmic_bxtwc.c +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c @@ -586,7 +586,6 @@ static void bxtwc_shutdown(struct platform_device *pdev) disable_irq(pmic->irq); } =20 -#ifdef CONFIG_PM_SLEEP static int bxtwc_suspend(struct device *dev) { struct intel_soc_pmic *pmic =3D dev_get_drvdata(dev); @@ -603,8 +602,8 @@ static int bxtwc_resume(struct device *dev) enable_irq(pmic->irq); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume); + +static DEFINE_SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume); =20 static const struct acpi_device_id bxtwc_acpi_ids[] =3D { { "INT34D3", }, @@ -618,7 +617,7 @@ static struct platform_driver bxtwc_driver =3D { .shutdown =3D bxtwc_shutdown, .driver =3D { .name =3D "BXTWC PMIC", - .pm =3D &bxtwc_pm_ops, + .pm =3D pm_sleep_ptr(&bxtwc_pm_ops), .acpi_match_table =3D ACPI_PTR(bxtwc_acpi_ids), }, }; diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic= _core.c index 5e8c94e008ed..96303aa87bc1 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -104,7 +104,6 @@ static void intel_soc_pmic_shutdown(struct i2c_client *= i2c) return; } =20 -#if defined(CONFIG_PM_SLEEP) static int intel_soc_pmic_suspend(struct device *dev) { struct intel_soc_pmic *pmic =3D dev_get_drvdata(dev); @@ -122,10 +121,9 @@ static int intel_soc_pmic_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend, - intel_soc_pmic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_susp= end, + intel_soc_pmic_resume); =20 static const struct i2c_device_id intel_soc_pmic_i2c_id[] =3D { { } @@ -143,7 +141,7 @@ MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match); static struct i2c_driver intel_soc_pmic_i2c_driver =3D { .driver =3D { .name =3D "intel_soc_pmic_i2c", - .pm =3D &intel_soc_pmic_pm_ops, + .pm =3D pm_sleep_ptr(&intel_soc_pmic_pm_ops), .acpi_match_table =3D ACPI_PTR(intel_soc_pmic_acpi_match), }, .probe =3D intel_soc_pmic_i2c_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8949EC25B06 for ; Sun, 7 Aug 2022 14:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235000AbiHGOzC (ORCPT ); Sun, 7 Aug 2022 10:55:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234614AbiHGOyo (ORCPT ); Sun, 7 Aug 2022 10:54:44 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51716A46C for ; Sun, 7 Aug 2022 07:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883985; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vu38q2fvxbTDWC0Wp85qSUryAadcgeU2L9z5MeFAmEE=; b=gKv68bx0OS3N05Kvtmy5FDstSL1q6tmbiq5HDr/fldBMh7m90J6PaAKUkFuar4Gt2JpW2h znj4QS8S/8eg5O8cDqTmKyuVla9x5XnmUapr56FpXte+qlig14vVLEw6YT+KtIxc72kHhd CN9mN+cxvGrfQ/ubH7LQ4mKN788Flaw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 12/28] mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:31 +0200 Message-Id: <20220807145247.46107-13-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions 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 --- drivers/mfd/mcp-sa11x0.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index 4629dff187cd..1c9831b78cf9 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c @@ -255,7 +255,6 @@ static int mcp_sa11x0_remove(struct platform_device *de= v) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int mcp_sa11x0_suspend(struct device *dev) { struct mcp_sa11x0 *m =3D priv(dev_get_drvdata(dev)); @@ -277,17 +276,14 @@ static int mcp_sa11x0_resume(struct device *dev) =20 return 0; } -#endif =20 static const struct dev_pm_ops mcp_sa11x0_pm_ops =3D { -#ifdef CONFIG_PM_SLEEP .suspend =3D mcp_sa11x0_suspend, .freeze =3D mcp_sa11x0_suspend, .poweroff =3D mcp_sa11x0_suspend, .resume_noirq =3D mcp_sa11x0_resume, .thaw_noirq =3D mcp_sa11x0_resume, .restore_noirq =3D mcp_sa11x0_resume, -#endif }; =20 static struct platform_driver mcp_sa11x0_driver =3D { @@ -295,7 +291,7 @@ static struct platform_driver mcp_sa11x0_driver =3D { .remove =3D mcp_sa11x0_remove, .driver =3D { .name =3D DRIVER_NAME, - .pm =3D &mcp_sa11x0_pm_ops, + .pm =3D pm_sleep_ptr(&mcp_sa11x0_pm_ops), }, }; =20 --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E770EC19F2A for ; Sun, 7 Aug 2022 14:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235156AbiHGOzP (ORCPT ); Sun, 7 Aug 2022 10:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234877AbiHGOyv (ORCPT ); Sun, 7 Aug 2022 10:54:51 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C6A4AE6F; Sun, 7 Aug 2022 07:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883985; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KhmQUAzyoS18HNqAM0H6H0gTiYDcgAB/NWukYcltpUA=; b=1tOBlgKh4w4cx6ZIBgNfPJksLmLV5DvkuOE1hCKxCnxkMQAujeBLnwvvA+n4acrS5KiUkW 0PeQtmaSKxTd3onupHJXmHEwcmK/gmXighvkvPBasrd4HsPCswl0zUrWE6j1khLzvcx5c/ 3HWZpVgpZo+YOTpnj5iCIDvwSX2JJlA= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , linux-samsung-soc@vger.kernel.org Subject: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:32 +0200 Message-Id: <20220807145247.46107-14-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz Cc: linux-samsung-soc@vger.kernel.org Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/sec-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 1fb29c45f5cf..a467de2b2fea 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -455,7 +455,6 @@ static void sec_pmic_shutdown(struct i2c_client *i2c) regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); } =20 -#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend(struct device *dev) { struct i2c_client *i2c =3D to_i2c_client(dev); @@ -488,14 +487,14 @@ static int sec_pmic_resume(struct device *dev) =20 return 0; } -#endif /* CONFIG_PM_SLEEP */ =20 -static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resum= e); +static DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, + sec_pmic_suspend, sec_pmic_resume); =20 static struct i2c_driver sec_pmic_driver =3D { .driver =3D { .name =3D "sec_pmic", - .pm =3D &sec_pmic_pm_ops, + .pm =3D pm_sleep_ptr(&sec_pmic_pm_ops), .of_match_table =3D sec_dt_match, }, .probe =3D sec_pmic_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4856C19F2A for ; Sun, 7 Aug 2022 14:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233939AbiHGOzU (ORCPT ); Sun, 7 Aug 2022 10:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234594AbiHGOy7 (ORCPT ); Sun, 7 Aug 2022 10:54:59 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E0A7B1FA for ; Sun, 7 Aug 2022 07:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883985; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FK51yenZc/JKwR0w5a5iJeX2DvPOzWAPhfYWX6WSnq4=; b=bhMzruMTitPzWbryuc6eRMLJUyUvQ1Fb6Q6So+TJNJvu2c5gc5bO/TzwAVuDhTHgoBZliL e/1xMWyU4GdRZ8QmoXUcAiry8UCDaTdYap9xW61NYjB65kaDCTcvkPqlnAgAuA6x1imTRs 6y9nMzpXvTJGJ8xAAlIJyjMNAD8HjUc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 14/28] mfd: sm501: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:33 +0200 Message-Id: <20220807145247.46107-15-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions 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 --- drivers/mfd/sm501.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index bc0a2c38653e..81e15e646e77 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1432,8 +1432,6 @@ static int sm501_plat_probe(struct platform_device *d= ev) =20 } =20 -#ifdef CONFIG_PM - /* power management support */ =20 static void sm501_set_power(struct sm501_devdata *sm, int on) @@ -1509,10 +1507,6 @@ static int sm501_plat_resume(struct platform_device = *pdev) =20 return 0; } -#else -#define sm501_plat_suspend NULL -#define sm501_plat_resume NULL -#endif =20 /* Initialisation data for PCI devices */ =20 @@ -1714,8 +1708,8 @@ static struct platform_driver sm501_plat_driver =3D { }, .probe =3D sm501_plat_probe, .remove =3D sm501_plat_remove, - .suspend =3D sm501_plat_suspend, - .resume =3D sm501_plat_resume, + .suspend =3D pm_sleep_ptr(sm501_plat_suspend), + .resume =3D pm_sleep_ptr(sm501_plat_resume), }; =20 static int __init sm501_base_init(void) --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DE1AC19F2A for ; Sun, 7 Aug 2022 14:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235216AbiHGOzZ (ORCPT ); Sun, 7 Aug 2022 10:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbiHGOzH (ORCPT ); Sun, 7 Aug 2022 10:55:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A2FB1CB for ; Sun, 7 Aug 2022 07:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H0eCKU4RK3zKJNHbgkID62SWdcosUW+2jUir4hogae8=; b=aJmRmK2w5BLZGzZBETjaYxstdi2UYIJkMB1R/qe7fIgTHf2ljcx+hLTOWDQIsGfLuuh+Td ZQuW+n62FrsWnvwP45jiTQM12hRQZYq5Nt2HNn4myxBPdEc8NzEK7qiariJ7555L5kXzMZ 9ZMjRKb3jQoOPprVApIjO3E6ko7P8Go= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 15/28] mfd: tc6387xb: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:34 +0200 Message-Id: <20220807145247.46107-16-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions 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 --- drivers/mfd/tc6387xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index e846e4d26b6e..5392da6ba7b0 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c @@ -40,7 +40,6 @@ static const struct resource tc6387xb_mmc_resources[] =3D= { =20 /*------------------------------------------------------------------------= --*/ =20 -#ifdef CONFIG_PM static int tc6387xb_suspend(struct platform_device *dev, pm_message_t stat= e) { struct tc6387xb *tc6387xb =3D platform_get_drvdata(dev); @@ -67,10 +66,6 @@ static int tc6387xb_resume(struct platform_device *dev) =20 return 0; } -#else -#define tc6387xb_suspend NULL -#define tc6387xb_resume NULL -#endif =20 /*------------------------------------------------------------------------= --*/ =20 @@ -220,8 +215,8 @@ static struct platform_driver tc6387xb_platform_driver = =3D { }, .probe =3D tc6387xb_probe, .remove =3D tc6387xb_remove, - .suspend =3D tc6387xb_suspend, - .resume =3D tc6387xb_resume, + .suspend =3D pm_sleep_ptr(tc6387xb_suspend), + .resume =3D pm_sleep_ptr(tc6387xb_resume), }; =20 module_platform_driver(tc6387xb_platform_driver); --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EC11C19F2A for ; Sun, 7 Aug 2022 14:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234614AbiHGOzr (ORCPT ); Sun, 7 Aug 2022 10:55:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234906AbiHGOzP (ORCPT ); Sun, 7 Aug 2022 10:55:15 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F68D9B for ; Sun, 7 Aug 2022 07:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=43gAJLh+NO1r8Oyt6XxRvPraTLloEC1o3eOKZ6oy6Nw=; b=B6zlrFb7+LpdkfI9xxOJzHOPp4YViGVmXNLrD9rJ/0ymSiIj5Ktqo+x3WsbaFV/NPbu+F7 h2jn5hzwWW0QT7/PYPNmVB9TcRSNfYnrcATDi+JmCeyPTvDAi/httHT1jztz+NJByHM4AA 2l0ou23paU4aIaHhNr9m0c/oddll5sQ= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 16/28] mfd: tps6586x: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:35 +0200 Message-Id: <20220807145247.46107-17-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- drivers/mfd/tps6586x.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index c9303d3d6602..fd57c3974615 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -269,15 +269,11 @@ static void tps6586x_irq_sync_unlock(struct irq_data = *data) mutex_unlock(&tps6586x->irq_lock); } =20 -#ifdef CONFIG_PM_SLEEP static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int o= n) { struct tps6586x *tps6586x =3D irq_data_get_irq_chip_data(irq_data); return irq_set_irq_wake(tps6586x->irq, on); } -#else -#define tps6586x_irq_set_wake NULL -#endif =20 static struct irq_chip tps6586x_irq_chip =3D { .name =3D "tps6586x", @@ -285,7 +281,7 @@ static struct irq_chip tps6586x_irq_chip =3D { .irq_bus_sync_unlock =3D tps6586x_irq_sync_unlock, .irq_disable =3D tps6586x_irq_disable, .irq_enable =3D tps6586x_irq_enable, - .irq_set_wake =3D tps6586x_irq_set_wake, + .irq_set_wake =3D pm_sleep_ptr(tps6586x_irq_set_wake), }; =20 static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 167F9C19F2A for ; Sun, 7 Aug 2022 14:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234841AbiHGOzv (ORCPT ); Sun, 7 Aug 2022 10:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbiHGOzX (ORCPT ); Sun, 7 Aug 2022 10:55:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1246175 for ; Sun, 7 Aug 2022 07:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ILGkOjBbxQ6/oFH45I21cYP8YppPBAHJarOOSD0Anzg=; b=Ji1TNYdO9uNnL434iMBgQ4dfjBePw83p7ofilPXqQDHIk2QLiuxO7nc4TE6PwAXFV2Byv9 XghPAVeetYDznix7FhwviD9hrKvbSIFo7mAgqISjj+xl6YGzsVf/H8VF33MYRo9dlC0CWr asywwHCFzR8/Bq9QtsuuqmP9e2It1fc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , patches@opensource.cirrus.com Subject: [PATCH 17/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:36 +0200 Message-Id: <20220807145247.46107-18-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the .runtime_suspend/.runtime_resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM 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. Note that this driver should probably use the new DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide .suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and pm_runtime_force_resume() respectively; unless those callbacks really aren't needed. Signed-off-by: Paul Cercueil Cc: patches@opensource.cirrus.com --- drivers/mfd/wm8994-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 7b1d270722ba..a27a13b5ae1e 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -110,7 +110,6 @@ static const char *wm8958_main_supplies[] =3D { "SPKVDD2", }; =20 -#ifdef CONFIG_PM static int wm8994_suspend(struct device *dev) { struct wm8994 *wm8994 =3D dev_get_drvdata(dev); @@ -213,7 +212,6 @@ static int wm8994_resume(struct device *dev) =20 return ret; } -#endif =20 #ifdef CONFIG_REGULATOR static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) @@ -676,13 +674,13 @@ static const struct i2c_device_id wm8994_i2c_id[] =3D= { MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); =20 static const struct dev_pm_ops wm8994_pm_ops =3D { - SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) + RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) }; =20 static struct i2c_driver wm8994_i2c_driver =3D { .driver =3D { .name =3D "wm8994", - .pm =3D &wm8994_pm_ops, + .pm =3D pm_ptr(&wm8994_pm_ops), .of_match_table =3D wm8994_of_match, }, .probe =3D wm8994_i2c_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94633C19F2A for ; Sun, 7 Aug 2022 14:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234683AbiHGO4Q (ORCPT ); Sun, 7 Aug 2022 10:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235356AbiHGOzn (ORCPT ); Sun, 7 Aug 2022 10:55:43 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69F20B495 for ; Sun, 7 Aug 2022 07:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1ZU+nsSpk1Q/xY16OKp9UDZMSHWzUMwic9ChJQcafM=; b=Scuasrp36cjvgyC/DDzU3KWW8gBSUZj+MZ06wEJjlypHmaoujxjZtYjse3X/Jj0PSNcRsL W1kWrb3V4FxHfVoyhB2WBMQ1QsQhBOOYkuOxw+HjkmB8mZnnTGSmDjoqlzD6zuzY8sK9Ol G7mCgdrp0Mj87ZPHZNwFSgiV1+Fk89M= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 18/28] mfd: max77620: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:37 +0200 Message-Id: <20220807145247.46107-19-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/max77620.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index fec2096474ad..e8ee4b132fb7 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -574,7 +574,6 @@ static int max77620_probe(struct i2c_client *client, return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int max77620_set_fps_period(struct max77620_chip *chip, int fps_id, int time_period) { @@ -681,7 +680,6 @@ static int max77620_i2c_resume(struct device *dev) =20 return 0; } -#endif =20 static const struct i2c_device_id max77620_id[] =3D { {"max77620", MAX77620}, @@ -690,14 +688,13 @@ static const struct i2c_device_id max77620_id[] =3D { {}, }; =20 -static const struct dev_pm_ops max77620_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(max77620_pm_ops, + max77620_i2c_suspend, max77620_i2c_resume); =20 static struct i2c_driver max77620_driver =3D { .driver =3D { .name =3D "max77620", - .pm =3D &max77620_pm_ops, + .pm =3D pm_sleep_ptr(&max77620_pm_ops), }, .probe =3D max77620_probe, .id_table =3D max77620_id, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4718FC19F2A for ; Sun, 7 Aug 2022 14:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235073AbiHGO43 (ORCPT ); Sun, 7 Aug 2022 10:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235041AbiHGOzy (ORCPT ); Sun, 7 Aug 2022 10:55:54 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D79B857 for ; Sun, 7 Aug 2022 07:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883987; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1i9W1PSbipFYRxBVR9VHxY/xM8GZD5sSA1L5JLSKCyU=; b=xp0VNEp9KHBmmvp5qIXup4UrPSOD3CirgvGCoHKAXpjW4JPjMdYb+aqVQtanNqQiCXKUnX cafi14TR8juVdJxGmoKjZei9dky+17jclxWdNNITR69p9tOzP+blc/3ydpfHubahMuydjt oseRGMfaP1fvTiWUV3FB73naIDnOKvU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 19/28] mfd: t7l66xb: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:38 +0200 Message-Id: <20220807145247.46107-20-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions 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 --- drivers/mfd/t7l66xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 5369c67e3280..74d26dce2003 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c @@ -257,7 +257,6 @@ static void t7l66xb_detach_irq(struct platform_device *= dev) =20 /*------------------------------------------------------------------------= --*/ =20 -#ifdef CONFIG_PM static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state) { struct t7l66xb *t7l66xb =3D platform_get_drvdata(dev); @@ -288,10 +287,6 @@ static int t7l66xb_resume(struct platform_device *dev) =20 return 0; } -#else -#define t7l66xb_suspend NULL -#define t7l66xb_resume NULL -#endif =20 /*------------------------------------------------------------------------= --*/ =20 @@ -420,8 +415,8 @@ static struct platform_driver t7l66xb_platform_driver = =3D { .driver =3D { .name =3D "t7l66xb", }, - .suspend =3D t7l66xb_suspend, - .resume =3D t7l66xb_resume, + .suspend =3D pm_sleep_ptr(t7l66xb_suspend), + .resume =3D pm_sleep_ptr(t7l66xb_resume), .probe =3D t7l66xb_probe, .remove =3D t7l66xb_remove, }; --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07A87C19F2A for ; Sun, 7 Aug 2022 14:56:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234449AbiHGO4g (ORCPT ); Sun, 7 Aug 2022 10:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234539AbiHGO4L (ORCPT ); Sun, 7 Aug 2022 10:56:11 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7570E9E for ; Sun, 7 Aug 2022 07:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883987; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Wcqw8v4yEtQTQLoqAM27e1h0VJ0qSd8BKRCHlYay5o=; b=Ok0I2oLiNXtVv+CN6haNu485gyrbK6Xd2UsofgcOKfD1g0KnQLAWf1GndyaSKFYLxV2y5h pRCxoQLsKsO6vGM0UfJzwmsXAlnYwCc4Luyl+zS+9dP+PDT70j7C6YvSbWNo9T7M1B+QrC sph1EAovSJ9J3wjopDJRewlmwDHBVzI= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , patches@opensource.cirrus.com Subject: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:39 +0200 Message-Id: <20220807145247.46107-21-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Only export the arizona_pm_ops if CONFIG_PM is set, but leave the suspend/resume functions (and related code) outside #ifdef guards. If CONFIG_PM is not set, the arizona_pm_ops will be defined as "static __maybe_unused", and the structure plus all the callbacks will be automatically dropped by the compiler. 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 Cc: patches@opensource.cirrus.com Reported-by: kernel test robot --- drivers/mfd/arizona-core.c | 21 +++++++++++---------- drivers/mfd/arizona-i2c.c | 2 +- drivers/mfd/arizona-spi.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index cbf1dd90b70d..c1acc9521f83 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -480,7 +480,6 @@ static int wm5102_clear_write_sequencer(struct arizona = *arizona) return 0; } =20 -#ifdef CONFIG_PM static int arizona_isolate_dcvdd(struct arizona *arizona) { int ret; @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev) =20 return 0; } -#endif =20 -#ifdef CONFIG_PM_SLEEP static int arizona_suspend(struct device *dev) { struct arizona *arizona =3D dev_get_drvdata(dev); @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev) =20 return 0; } -#endif =20 +#ifndef CONFIG_PM +static __maybe_unused +#endif const struct dev_pm_ops arizona_pm_ops =3D { - SET_RUNTIME_PM_OPS(arizona_runtime_suspend, - arizona_runtime_resume, - NULL) - SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, - arizona_resume_noirq) + RUNTIME_PM_OPS(arizona_runtime_suspend, + arizona_runtime_resume, + NULL) + SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, + arizona_resume_noirq) }; +#ifdef CONFIG_PM EXPORT_SYMBOL_GPL(arizona_pm_ops); +#endif =20 #ifdef CONFIG_OF static int arizona_of_get_core_pdata(struct arizona *arizona) diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 6d83e6b9a692..8799d9183bee 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c @@ -119,7 +119,7 @@ static const struct of_device_id arizona_i2c_of_match[]= =3D { static struct i2c_driver arizona_i2c_driver =3D { .driver =3D { .name =3D "arizona", - .pm =3D &arizona_pm_ops, + .pm =3D pm_ptr(&arizona_pm_ops), .of_match_table =3D of_match_ptr(arizona_i2c_of_match), }, .probe =3D arizona_i2c_probe, diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 941b0267d09d..da05b966d48c 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c @@ -282,7 +282,7 @@ static const struct of_device_id arizona_spi_of_match[]= =3D { static struct spi_driver arizona_spi_driver =3D { .driver =3D { .name =3D "arizona", - .pm =3D &arizona_pm_ops, + .pm =3D pm_ptr(&arizona_pm_ops), .of_match_table =3D of_match_ptr(arizona_spi_of_match), .acpi_match_table =3D ACPI_PTR(arizona_acpi_match), }, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7166C19F2A for ; Sun, 7 Aug 2022 14:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234559AbiHGO4q (ORCPT ); Sun, 7 Aug 2022 10:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235287AbiHGO4R (ORCPT ); Sun, 7 Aug 2022 10:56:17 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C23A47C for ; Sun, 7 Aug 2022 07:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883987; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p1xoIsiO7mQSSvaA/WgywtyIwuifGHhfOG3YY3mgLLc=; b=oGu8CiFg58CaOHxTaXzqPVAqIwT9IwuIZ0Ucuuu7eY1pMbYCUAy9YU+vDnw07EHcIG/7AJ NttHBOJ8IlB3FdjWybop7Com0I8eLnFy1CUfE/q7+dEGvUNCx3aFvSOYhp0pTrLDZxMRJh YVnWxv4BdaB0N7/eSaO1dlrBbtdgdkw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 21/28] mfd: max14577: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:40 +0200 Message-Id: <20220807145247.46107-22-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Chanwoo Choi Cc: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/max14577.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index 6c487fa14e9c..9de29a8070c7 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c @@ -482,7 +482,6 @@ static const struct i2c_device_id max14577_i2c_id[] =3D= { }; MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); =20 -#ifdef CONFIG_PM_SLEEP static int max14577_suspend(struct device *dev) { struct i2c_client *i2c =3D to_i2c_client(dev); @@ -515,14 +514,13 @@ static int max14577_resume(struct device *dev) =20 return 0; } -#endif /* CONFIG_PM_SLEEP */ =20 -static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_re= sume); =20 static struct i2c_driver max14577_i2c_driver =3D { .driver =3D { .name =3D "max14577", - .pm =3D &max14577_pm, + .pm =3D pm_sleep_ptr(&max14577_pm), .of_match_table =3D max14577_dt_match, }, .probe =3D max14577_i2c_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48086C19F2A for ; Sun, 7 Aug 2022 14:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235379AbiHGO5C (ORCPT ); Sun, 7 Aug 2022 10:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235067AbiHGO41 (ORCPT ); Sun, 7 Aug 2022 10:56:27 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2353DAE51 for ; Sun, 7 Aug 2022 07:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883987; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDrJzPRAk8lMfS/cEwJyVSOCOy6jdbYLWB99CWyQXbk=; b=QOqQky0wTCphsemEEWufVQdHEk2UlgA3ErIhZoRwtwIzlisaQ3g7YCvGaHRPVCgRByMk5r 5V6XlP/dpUFpWDLsybqcg3DgMuDzaG3vOlpit8WnWcgTgI54ztYR5pXZkdav95DNTWffl6 tv7NCgFbWuW2hGvW2Sjz1296sX6Esbs= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 22/28] mfd: max77686: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:41 +0200 Message-Id: <20220807145247.46107-23-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Chanwoo Choi Cc: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/max77686.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 2ac64277fb84..f8e863f3fc95 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -226,7 +226,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int max77686_suspend(struct device *dev) { struct i2c_client *i2c =3D to_i2c_client(dev); @@ -261,14 +260,13 @@ static int max77686_resume(struct device *dev) =20 return 0; } -#endif /* CONFIG_PM_SLEEP */ =20 -static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_re= sume); =20 static struct i2c_driver max77686_i2c_driver =3D { .driver =3D { .name =3D "max77686", - .pm =3D &max77686_pm, + .pm =3D pm_sleep_ptr(&max77686_pm), .of_match_table =3D max77686_pmic_dt_match, }, .probe_new =3D max77686_i2c_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C39E6C19F2A for ; Sun, 7 Aug 2022 14:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233552AbiHGO5F (ORCPT ); Sun, 7 Aug 2022 10:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235119AbiHGO4a (ORCPT ); Sun, 7 Aug 2022 10:56:30 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050B1B1EB for ; Sun, 7 Aug 2022 07:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883988; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LDstWh8ONHhQiaISt3lPcKYc1wUzyQ3iFEhG0tcL52Y=; b=ny6l/qwaMOdLtlBwngP9cEdL9zEkAxXXaEYjrvuFx4gvI14iwSce1EeGZsvtGiCAkGc0hz Jacblh3nCtaKHQ65klSErWes6V8rxo1XWxjgMbCrbS7P0WdeaRsMZQD0gRrbo8RpK9Xn7H jfxbZnUnvvukQ+qzvsOdFh35mIDP2y0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 23/28] mfd: motorola-cpcap: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:42 +0200 Message-Id: <20220807145247.46107-24-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/motorola-cpcap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c index 265464b5d7cc..ae8930eff72d 100644 --- a/drivers/mfd/motorola-cpcap.c +++ b/drivers/mfd/motorola-cpcap.c @@ -221,7 +221,6 @@ static const struct regmap_config cpcap_regmap_config = =3D { .val_format_endian =3D REGMAP_ENDIAN_LITTLE, }; =20 -#ifdef CONFIG_PM_SLEEP static int cpcap_suspend(struct device *dev) { struct spi_device *spi =3D to_spi_device(dev); @@ -239,9 +238,8 @@ static int cpcap_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); =20 static const struct mfd_cell cpcap_mfd_devices[] =3D { { @@ -346,7 +344,7 @@ static struct spi_driver cpcap_driver =3D { .driver =3D { .name =3D "cpcap-core", .of_match_table =3D cpcap_of_match, - .pm =3D &cpcap_pm, + .pm =3D pm_sleep_ptr(&cpcap_pm), }, .probe =3D cpcap_probe, .id_table =3D cpcap_spi_ids, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 169C4C19F2A for ; Sun, 7 Aug 2022 14:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235345AbiHGO5J (ORCPT ); Sun, 7 Aug 2022 10:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235066AbiHGO4c (ORCPT ); Sun, 7 Aug 2022 10:56:32 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2535EB1FA for ; Sun, 7 Aug 2022 07:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883988; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+c3KkknlLtwUBDEYtG1+TT7sAqGqh7aGNoFQtGPxwY=; b=LgE+N5Y8fnH6/Eby5wJnHx3/lB0wa8IBVwI7LmvEz9hJwlzNEZSf+IOOlx++OIWNiHgZqq JV1QCdVCezRgKWNQzI8hBVrFp+HRjKvQOmbpQ0gwOudUQp/goGTQprr9IEUL+ii+V9d85K XrHtlNr6EhWv7jiql6PwM+orprfsutw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang Subject: [PATCH 24/28] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:43 +0200 Message-Id: <20220807145247.46107-25-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang --- drivers/mfd/sprd-sc27xx-spi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index d05a47c5187f..ea68d73e5d1c 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -215,7 +215,6 @@ static int sprd_pmic_probe(struct spi_device *spi) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int sprd_pmic_suspend(struct device *dev) { struct sprd_pmic *ddata =3D dev_get_drvdata(dev); @@ -235,9 +234,9 @@ static int sprd_pmic_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_re= sume); +static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, + sprd_pmic_suspend, sprd_pmic_resume); =20 static const struct of_device_id sprd_pmic_match[] =3D { { .compatible =3D "sprd,sc2730", .data =3D &sc2730_data }, @@ -257,7 +256,7 @@ static struct spi_driver sprd_pmic_driver =3D { .driver =3D { .name =3D "sc27xx-pmic", .of_match_table =3D sprd_pmic_match, - .pm =3D &sprd_pmic_pm_ops, + .pm =3D pm_sleep_ptr(&sprd_pmic_pm_ops), }, .probe =3D sprd_pmic_probe, .id_table =3D sprd_pmic_spi_ids, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 397DAC19F2A for ; Sun, 7 Aug 2022 14:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235266AbiHGO5Q (ORCPT ); Sun, 7 Aug 2022 10:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234752AbiHGO4n (ORCPT ); Sun, 7 Aug 2022 10:56:43 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29ABC269 for ; Sun, 7 Aug 2022 07:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883988; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Di4PoDiPjRu7ZS4lHptDC2et/AkSYRZJ8WxHWXVd9fk=; b=M8PDLV+k4PAPs6D79cw8p2rh6Vx4VD2ELyDUhaqSKSWca15BHcIDzzjQ1MaYgg+XEYXWrV iWiVNeRH5E/4zQpjYAJHry4nbXXrkSxuxSKyTLBuDFe6gfzNRjhYRFAgHcIsgOevtlvSX2 hVwdvb9hWNozN9FFcBs+xLCexp2B12g= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:44 +0200 Message-Id: <20220807145247.46107-26-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Reported-by: kernel test robot --- drivers/mfd/stmfx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index 122f96094410..94af27346669 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -476,7 +476,6 @@ static int stmfx_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int stmfx_suspend(struct device *dev) { struct stmfx *stmfx =3D dev_get_drvdata(dev); @@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_res= ume); =20 static const struct of_device_id stmfx_of_match[] =3D { { .compatible =3D "st,stmfx-0300", }, @@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver =3D { .driver =3D { .name =3D "stmfx-core", .of_match_table =3D stmfx_of_match, - .pm =3D &stmfx_dev_pm_ops, + .pm =3D pm_sleep_ptr(&stmfx_dev_pm_ops), }, .probe =3D stmfx_probe, .remove =3D stmfx_remove, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08226C19F2A for ; Sun, 7 Aug 2022 14:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbiHGO5U (ORCPT ); Sun, 7 Aug 2022 10:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234838AbiHGO4q (ORCPT ); Sun, 7 Aug 2022 10:56:46 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C9C425DC for ; Sun, 7 Aug 2022 07:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ptxIOClzXAvyxR50upmaEEEEVGTnNXiaXnvmeGjVdJ4=; b=u4bs5OnvS8gkLjBxVHjqdJqNLX3/rCNdwg+PVk2wXxXMd5958OCSHjh9HGfbjENCMjkiAX fZJTv6x/ko+EyEjCWcslV2XwUnsqzyutGpk0CQZU8avXye+fby5yP+I+m0nX/ckfssPpWY wf98k8JzSZHs2PPtf1SAeoPcaiUVz+4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 26/28] mfd: stmpe: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:45 +0200 Message-Id: <20220807145247.46107-27-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Reported-by: kernel test robot --- drivers/mfd/stmpe-i2c.c | 4 +--- drivers/mfd/stmpe-spi.c | 4 +--- drivers/mfd/stmpe.c | 8 ++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index d3eedf3d607e..bf094cc9f9de 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c @@ -116,9 +116,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); static struct i2c_driver stmpe_i2c_driver =3D { .driver =3D { .name =3D "stmpe-i2c", -#ifdef CONFIG_PM - .pm =3D &stmpe_dev_pm_ops, -#endif + .pm =3D pm_sleep_ptr(&stmpe_dev_pm_ops), .of_match_table =3D stmpe_of_match, }, .probe =3D stmpe_i2c_probe, diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index ad8055a0e286..e9cbf33502b3 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c @@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver =3D { .driver =3D { .name =3D "stmpe-spi", .of_match_table =3D of_match_ptr(stmpe_spi_of_match), -#ifdef CONFIG_PM - .pm =3D &stmpe_dev_pm_ops, -#endif + .pm =3D pm_sleep_ptr(&stmpe_dev_pm_ops), }, .probe =3D stmpe_spi_probe, .remove =3D stmpe_spi_remove, diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index aeb9ea55f97d..a88cc1103589 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1508,7 +1508,6 @@ void stmpe_remove(struct stmpe *stmpe) mfd_remove_devices(stmpe->dev); } =20 -#ifdef CONFIG_PM static int stmpe_suspend(struct device *dev) { struct stmpe *stmpe =3D dev_get_drvdata(dev); @@ -1529,8 +1528,5 @@ static int stmpe_resume(struct device *dev) return 0; } =20 -const struct dev_pm_ops stmpe_dev_pm_ops =3D { - .suspend =3D stmpe_suspend, - .resume =3D stmpe_resume, -}; -#endif +const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, + stmpe_suspend, stmpe_resume); --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65E9CC19F2A for ; Sun, 7 Aug 2022 14:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235169AbiHGO5m (ORCPT ); Sun, 7 Aug 2022 10:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbiHGO5D (ORCPT ); Sun, 7 Aug 2022 10:57:03 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46C16B857 for ; Sun, 7 Aug 2022 07:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0c3a2/qF6KMNUu4+OEl7LBzPeW/O+IuR41ANjZXV6gA=; b=gEVfKW6UDfL26RCFk1Cf2TaBbBC/3e8QGdDpLsY8V6/ys5hhYbGuOUpmSPGvsPii3UgSxu dO+9KxfL1jQDYLxN+eGf9i2nHzjY3l6/PGZlInHtIJf5M21vWCgjIM/21JTv+e2N/yu5Ws 1dykgSE0gXVA4tncq32qyQ/YJovN5g0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 27/28] mfd: tc3589x: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:46 +0200 Message-Id: <20220807145247.46107-28-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions 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 --- drivers/mfd/tc3589x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 13583cdb93b6..ab7e0f6f5489 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -438,7 +438,6 @@ static int tc3589x_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int tc3589x_suspend(struct device *dev) { struct tc3589x *tc3589x =3D dev_get_drvdata(dev); @@ -466,9 +465,9 @@ static int tc3589x_resume(struct device *dev) =20 return ret; } -#endif =20 -static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resu= me); +static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, + tc3589x_suspend, tc3589x_resume); =20 static const struct i2c_device_id tc3589x_id[] =3D { { "tc35890", TC3589X_TC35890 }, @@ -485,7 +484,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id); static struct i2c_driver tc3589x_driver =3D { .driver =3D { .name =3D "tc3589x", - .pm =3D &tc3589x_dev_pm_ops, + .pm =3D pm_sleep_ptr(&tc3589x_dev_pm_ops), .of_match_table =3D of_match_ptr(tc3589x_match), }, .probe =3D tc3589x_probe, --=20 2.35.1 From nobody Sat Apr 11 19:54:29 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1816C19F2A for ; Sun, 7 Aug 2022 14:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234752AbiHGO5s (ORCPT ); Sun, 7 Aug 2022 10:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234743AbiHGO5O (ORCPT ); Sun, 7 Aug 2022 10:57:14 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A25B86B for ; Sun, 7 Aug 2022 07:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HXAu1XJSjG1R6eydkrP6zVuUiYRS2CkOzAvRMGBTLfE=; b=AkHEscQwOGdm1+nXFH9oCx96DvkWzOQdGjZmGTPshn5wmWOf7S+Aq4rv1xyGPFTot6tDNq oYqq0YhwH6dLc1RBeH8QHA4v+OmhEmO7jQjdw/coWRlpvLBRUH016DdZrS2u80WJF5u5No XHQpF4m/4lzvTXNnjvbMp8vKhhbEOZA= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 28/28] mfd: tc6393xb: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:47 +0200 Message-Id: <20220807145247.46107-29-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions 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 --- drivers/mfd/tc6393xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 0be5731685b4..9e1ecd92902c 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -814,7 +814,6 @@ static int tc6393xb_remove(struct platform_device *dev) return ret; } =20 -#ifdef CONFIG_PM static int tc6393xb_suspend(struct platform_device *dev, pm_message_t stat= e) { struct tc6393xb_platform_data *tcpd =3D dev_get_platdata(&dev->dev); @@ -877,16 +876,12 @@ static int tc6393xb_resume(struct platform_device *de= v) =20 return 0; } -#else -#define tc6393xb_suspend NULL -#define tc6393xb_resume NULL -#endif =20 static struct platform_driver tc6393xb_driver =3D { .probe =3D tc6393xb_probe, .remove =3D tc6393xb_remove, - .suspend =3D tc6393xb_suspend, - .resume =3D tc6393xb_resume, + .suspend =3D pm_sleep_ptr(tc6393xb_suspend), + .resume =3D pm_sleep_ptr(tc6393xb_resume), =20 .driver =3D { .name =3D "tc6393xb", --=20 2.35.1