From nobody Wed Apr 8 04:57:18 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 388CEECAAA1 for ; Sun, 23 Oct 2022 09:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJWJtO (ORCPT ); Sun, 23 Oct 2022 05:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbiJWJtM (ORCPT ); Sun, 23 Oct 2022 05:49:12 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A686BCEE for ; Sun, 23 Oct 2022 02:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518543; 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=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=kgb2K0N3EQq0luk0lhhXzMYrHyme9zzOFDWu8wKPFBkuqSry3SqyL4AWNrB6xM4PJipOup W7VMdgy9C95YrZ3A2iF07l0yi13+V8bPgVW4uhAIZCCt0ulYqqiZeiHEnRvS3mKmGSfVeX R2XF3LuDwrlh8XMbKOjQluhhNRCDo5w= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 01/28] mfd: 88pm80x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:25 +0100 Message-Id: <20221023094852.8035-2-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 907A8ECAAA1 for ; Sun, 23 Oct 2022 09:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbiJWJtY (ORCPT ); Sun, 23 Oct 2022 05:49:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiJWJtU (ORCPT ); Sun, 23 Oct 2022 05:49:20 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22F96BCEE for ; Sun, 23 Oct 2022 02:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518544; 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=v1iDgRdVM2mercE3ut+EO5L+yG7WE7yznsiwCD0Lt98=; b=TV0MZndoXOwRdei9zSfLhWa8OCd/Mx1VRctmJ+aRpmw2y0BpV5PBMUbL1ZHx4TdadNlq6O Q6s9CxhKrGZwCUCdcK249ntpNbNZLu5jar3PpZGFzs3TAaCJvVXZEv/9Ie8uN9526IFWF0 x9hrx+LyPF/zcEb/yFrt+gvQZfwOXfo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:26 +0100 Message-Id: <20221023094852.8035-3-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 BE4CAECAAA1 for ; Sun, 23 Oct 2022 09:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbiJWJtm (ORCPT ); Sun, 23 Oct 2022 05:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiJWJti (ORCPT ); Sun, 23 Oct 2022 05:49:38 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA37DED9 for ; Sun, 23 Oct 2022 02:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518544; 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=RmH+YiYpUPBPp3yS1R7ESWCNgocdrFNtdRwVFv9A680=; b=fCp4riuws/yV0z90McsIaD8AOSmeDlATXdIEtcZlsGuNd7LS8J/sE8HogShUDfwX+GxsYD YvVLzqNw9q9+ARe/rGF/Q9nmjK1LEOGYjI4I7gVIY+M945OucjK+6snNsVkJC2t2JDUeeo UXZjVazw7lJmUMe5PWM8eZlo5msa0I4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Michael Hennerich Subject: [PATCH v3 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:27 +0100 Message-Id: <20221023094852.8035-4-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil 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 Wed Apr 8 04:57:18 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 B9191C433FE for ; Sun, 23 Oct 2022 09:49:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbiJWJt4 (ORCPT ); Sun, 23 Oct 2022 05:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiJWJtr (ORCPT ); Sun, 23 Oct 2022 05:49:47 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5998C13EA1 for ; Sun, 23 Oct 2022 02:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518545; 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=a32yNu2Eeu11C00fM1RqTufFXXGAOLPmqPKGVg+1zOs=; b=bKNpXcm3d8NoHpBQnqNFOd2mxosxO1mrPVpwMyVyFQcp64FcVA8OGgP8CO6WLmgDOY3zK1 9HQlbDNabm/CwuAFXZMIdh8SfubKwCXqYgmTazHEjZPAcTzXLy9TR9aBrby9NFRkCLi5sb gi0RBTgMtcudSIDQnU2euBh7mTAfvGw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 04/28] mfd: max8925-i2c: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:28 +0100 Message-Id: <20221023094852.8035-5-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 14BC0C433FE for ; Sun, 23 Oct 2022 09:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbiJWJuI (ORCPT ); Sun, 23 Oct 2022 05:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiJWJuB (ORCPT ); Sun, 23 Oct 2022 05:50:01 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AB6F2E6BC for ; Sun, 23 Oct 2022 02:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518546; 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=+FBECTcdeQLfSp5bHcYAa/1zAvqLKLLp0tQ+VpGze+A=; b=WMXviK4znNH+cxAIFAOQi3B1ykMnVrOcVU4hf2Rqqlk058V80E+qnyk8E0LlkDXjEPWIXm 5qVkv3kePJ7wNXzCipfnq9MYT16MVBahctpgvp0h4oxMOe2Waq01lOVUy6yVlaUaKThAzq zocXklgI+/PciXSlgUahWpIe9bqshyo= 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 v3 05/28] mfd: mt6397-irq: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:29 +0100 Message-Id: <20221023094852.8035-6-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 eff53fed8fe7..72f923e47752 100644 --- a/drivers/mfd/mt6397-irq.c +++ b/drivers/mfd/mt6397-irq.c @@ -54,7 +54,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); @@ -68,9 +67,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", @@ -78,7 +74,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 Wed Apr 8 04:57:18 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 3F237ECAAA1 for ; Sun, 23 Oct 2022 09:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbiJWJuY (ORCPT ); Sun, 23 Oct 2022 05:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbiJWJuR (ORCPT ); Sun, 23 Oct 2022 05:50:17 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92AB73AB03 for ; Sun, 23 Oct 2022 02:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518546; 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=0q1o3KBhQ5MOOQZOY2QmugcO19dZJBIvTlnLlJG5KlM=; b=iRNen0c/8Ot1Qe7QRuJCfD2BCxA+y4O7MkfUepGe23zXEeRHs/SygVUWMexDvzbBKoVg3D MdJvDrnKkYq4b3hHVEJEBmg39aq9rcXl3WrlMqinr97rB8BojBS91myMwK/uf30DCQYP7T /4gF8D5RveRS4dPpWSUVXshyilpGr8A= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 06/28] mfd: pcf50633: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:30 +0100 Message-Id: <20221023094852.8035-7-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 1B621ECAAA1 for ; Sun, 23 Oct 2022 09:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbiJWJun (ORCPT ); Sun, 23 Oct 2022 05:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbiJWJub (ORCPT ); Sun, 23 Oct 2022 05:50:31 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FEF51A1A for ; Sun, 23 Oct 2022 02:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518547; 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=41LrJxU80KiCvA5q7AmgY7aUdotJZRC7pzTXsCNxuuM=; b=V8D/Jee3FZyV0+Iwh4Ob6cs7rOCY+4P4GLLr+8DhMPwWVSigTbLXmPbwDMQu7QSCkQjJv6 Nd+rOqbOch6fezbHmrdsIIv5h2lsw19Gs/s4wK+FnEbbwH5BRDcMopJ6ZmOpxcRhnAp0aF KGIsP+1CIqWJPN5Z5G2rr76IwjEDIiE= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 07/28] mfd: rc5t583-irq: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:31 +0100 Message-Id: <20221023094852.8035-8-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 539C8ECAAA1 for ; Sun, 23 Oct 2022 09:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbiJWJvB (ORCPT ); Sun, 23 Oct 2022 05:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiJWJum (ORCPT ); Sun, 23 Oct 2022 05:50:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0AD03ECD0 for ; Sun, 23 Oct 2022 02:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518547; 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=3M9dCoUiG7SdzuIW6iaf9KAa+/qkvhEMPsTc9+Iggvw=; b=Hu+oDwDkdnYZX6c5HGfyuyRIFGXcLqOLji3RgwBRZ+GeLGd5dcKaBrd9841snyAius7VDJ QzIVd3YQBUbp29WD/XwyqhT/wfhuWldPSFkkqGJ4dvjgMdOD21GNC7l6SooEacairfkNxu 7+pX0qcDiCtlUui5J/nBk3vSaICD9Fk= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 08/28] mfd: stpmic1: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:32 +0100 Message-Id: <20221023094852.8035-9-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 0D335C433FE for ; Sun, 23 Oct 2022 09:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbiJWJvM (ORCPT ); Sun, 23 Oct 2022 05:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiJWJu4 (ORCPT ); Sun, 23 Oct 2022 05:50:56 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6838F5B7AD for ; Sun, 23 Oct 2022 02:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518548; 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=o88MccR3qEu1Ka3g1RWgK0rEm5DdYE6bq3HPlQGFNi4=; b=pcuJSH76iZA0NzImnhzEJW9EKq7oVQaT+snLzlGBC0H2whCUg2u8YgmO21xYq33N8W+IMH CddyIvSF3nqZAmX/czfADjkUGj59SSs6bgr9yHl4BqX+B/VEEiF4Ro35jkeR6Yh6vSWmKd /i15obtEisSF1mLVDw/ZgPzDH9fmgU0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 09/28] mfd: ucb1x00: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:33 +0100 Message-Id: <20221023094852.8035-10-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 94ADDECAAA1 for ; Sun, 23 Oct 2022 09:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230263AbiJWJvT (ORCPT ); Sun, 23 Oct 2022 05:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbiJWJu7 (ORCPT ); Sun, 23 Oct 2022 05:50:59 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DF7C41D31 for ; Sun, 23 Oct 2022 02:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518549; 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=jNM14hgERipulNrTxZJyirqtg7ieEuWp63IzBQfH5BM=; b=Bn7vamxgb0atnUmSwqU3A1rZKH3zLQJnIZe6UpCL/VQVUzf6emW2Bx+7bgSMNy9Hbci/NI iRKBJ2GzrcHP6k6fElnZm7lp5y2abSPgzckITMQ+k5qUXlBZVzcu/83uN7bs2uzTr58OB+ CngucT5u9FgtvfOBHQOx3gNyAukapE4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 10/28] mfd: 88pm860x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:34 +0100 Message-Id: <20221023094852.8035-11-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 73579C433FE for ; Sun, 23 Oct 2022 09:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbiJWJvc (ORCPT ); Sun, 23 Oct 2022 05:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiJWJvH (ORCPT ); Sun, 23 Oct 2022 05:51:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165E0564F9 for ; Sun, 23 Oct 2022 02:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518549; 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=4kZIVuuKKO+sS/oNnpnJC3ag5t6waBzISKhOioOsnm4=; b=F7ZT/58jdkSWGmpsKrL/S1pQ/KE/OC+iTOv51KZIWLYATApCXwIuUB+deozMGhSSoahyip BS7uSBZffafdO6/98lczYrr542NPNbegeyQO2xXtC7tcjds7i6G9qMZYtW4Dl2Is3KfRsT sN9VWAtRaEqEfE4xC1yX6xsRceeUJlE= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 11/28] mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:35 +0100 Message-Id: <20221023094852.8035-12-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 603D1ECAAA1 for ; Sun, 23 Oct 2022 09:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbiJWJvi (ORCPT ); Sun, 23 Oct 2022 05:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbiJWJvQ (ORCPT ); Sun, 23 Oct 2022 05:51:16 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F3B61D78 for ; Sun, 23 Oct 2022 02:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518550; 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=PcfiZpIziLwA4ODr10aXNC1rF+NYGqY0uv8N27EWE4c=; b=YhTvZVmHDDsGDnwPpkTYrQVyMJ85ouFIUx8bvNDhK1W0Z3J6cXqelICtDze3JJLHIwhCus 5LBsz9nWnLdoLPzBuXsakv6NaqyS2hbN6aQp6HayJws1Y5OL9i63m9UWqGAQ9n/2f16+PW 4HHMWZyjiV860Ke+MlvR/rTrMBW3J9k= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 12/28] mfd: sec: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:36 +0100 Message-Id: <20221023094852.8035-13-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil 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 Wed Apr 8 04:57:18 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 54336ECAAA1 for ; Sun, 23 Oct 2022 09:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230197AbiJWJvs (ORCPT ); Sun, 23 Oct 2022 05:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbiJWJva (ORCPT ); Sun, 23 Oct 2022 05:51:30 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8626753A8 for ; Sun, 23 Oct 2022 02:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518550; 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=6nRVOy34FSWnz35RTkSCNiLoYnujLTUllYE1MRb8dnM=; b=SmcZDH4KIEEkbU/WdZKwwliQkfoxLuLba9mgknhsRQuEXpgJuvPLWt5anmkAZLG/s6HigV XvzOSTPJJTDjMOeSzW5FKq4Fl9Kd+14MFKQqiDHDClnJUSfh1plgXtw2y3p/RIWrveNnwx fwAXvG6XWJ9FvOIhaf4n407CblusWCU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 13/28] mfd: sm501: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:37 +0100 Message-Id: <20221023094852.8035-14-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 3ac4508a6742..28027982cf69 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 Wed Apr 8 04:57:18 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 0FCA9C433FE for ; Sun, 23 Oct 2022 09:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbiJWJvz (ORCPT ); Sun, 23 Oct 2022 05:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbiJWJvq (ORCPT ); Sun, 23 Oct 2022 05:51:46 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DACE75FDA for ; Sun, 23 Oct 2022 02:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518551; 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=VklgnW+uBOCoO+RRy4aqJ12OaIfCdghjrJSE0/tnQoc=; b=VAwl/6kfncV2uyXCN6oQ65qasZTcAlL1v5LXBI4n++1IXjBf9NTOsXuBouV+GbrXVdyn9s E1WmT5sZQUZd5c/BOXywoizANoLKuVfi1JnkBs+lKC2k+k4/uk077o/27ZZFJE59XiUL5X JmAGepzU2NX8mRZYrKfquHoDD8Ky3eM= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 14/28] mfd: tc6387xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:38 +0100 Message-Id: <20221023094852.8035-15-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 077A2C433FE for ; Sun, 23 Oct 2022 09:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbiJWJwN (ORCPT ); Sun, 23 Oct 2022 05:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbiJWJwJ (ORCPT ); Sun, 23 Oct 2022 05:52:09 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FEAD754B3 for ; Sun, 23 Oct 2022 02:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518552; 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=C/CZfgeHadcU1fuJomu2DjVRR0sBKfhmzKi2+xTgRd8=; b=KWW5ShZKnp6gjISj0AbHVV6/r/XBPH28JqPe5zr7JiKugFf1U58ilHjvnuLXwg7EzcKOwh Xc66i1gAXijbV0itAU+9WPr3o85M6Gfn9P84Z0p5wgjBGIVMGeDQuFFHL3+z59pcEpyPZ+ F/UweYh07QCMZmKn6adiaKMpvGuCpkA= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 15/28] mfd: tps6586x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:39 +0100 Message-Id: <20221023094852.8035-16-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 71950C433FE for ; Sun, 23 Oct 2022 09:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbiJWJwl (ORCPT ); Sun, 23 Oct 2022 05:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbiJWJwj (ORCPT ); Sun, 23 Oct 2022 05:52:39 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A0F74DC2 for ; Sun, 23 Oct 2022 02:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518552; 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=lyyljsq433FjzziKmqqvZZTp5vtZQm0VWBzs9lEg4/Q=; b=Bl3qJQwnF/mgh0ZIe2ANQ9s2QygwMAyVqFAKAH0Qht5gnhf9aTanNjSzHHMn0rTOqhV4RQ iMUF7iMh7BYx9Xvd3IDhGphIsclQNcgAIRf3PUoufiwJo9pv7MB2dwJhb8f+IoJ2Pgo0ki 1ofViD+ouPLOUHCv3x7cD6ehVvbTJrU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 16/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:40 +0100 Message-Id: <20221023094852.8035-17-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. 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 Acked-by: Charles Keepax --- 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 Wed Apr 8 04:57:18 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 C2D13ECAAA1 for ; Sun, 23 Oct 2022 09:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbiJWJxB (ORCPT ); Sun, 23 Oct 2022 05:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiJWJw5 (ORCPT ); Sun, 23 Oct 2022 05:52:57 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B1175A835 for ; Sun, 23 Oct 2022 02:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518553; 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=p6dlhZlwLIf/lPMpMtYZKWAT+azhK3anbKwIEZa9zE8=; b=X3Izna6i+PuzhYrjVCdVd4B0BGYCC43zVSGK6WANLlnoavKLLK9b3BvNJVJAr3vHfzYuwt ow2x6ZKsfMqVZrApb7L/6HgRdsraAoKc2vKRQmXCUUXEb7Vmoj1ZwiH7/ZKPsqEucaKn9l OfAvR3dnb3ksURXBgeP+aWhaRJ9c1O4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 17/28] mfd: max77620: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:41 +0100 Message-Id: <20221023094852.8035-18-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 a6661e07035b..42fa9c4b97aa 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -576,7 +576,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) { @@ -683,7 +682,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}, @@ -692,14 +690,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 Wed Apr 8 04:57:18 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 8229FC433FE for ; Sun, 23 Oct 2022 09:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbiJWJxN (ORCPT ); Sun, 23 Oct 2022 05:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiJWJxL (ORCPT ); Sun, 23 Oct 2022 05:53:11 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F314760CD for ; Sun, 23 Oct 2022 02:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518553; 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=br301fRK+XR8bCfkYexTo4vtYjSJhFPTzOjfRomSgPs=; b=FN+w4sbgOYuu4k6UDjmFbxK1q5s3lW9Se3QRdNx20NVbKRBt74smUJFlL4th3zWy1wCQq7 Y0Oiy/9KJpd/1iYuKvKt0f0fXgToVBOLBKF7ZIxLfqzGxaGZFWwxhdRuOvoEwMXK0jW/2C E98fsVmN1iGY64TkrbEMKYvKqJwvqSk= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 18/28] mfd: t7l66xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:42 +0100 Message-Id: <20221023094852.8035-19-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 663ffd4b8570..1d9d1d38d068 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 @@ -416,8 +411,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 Wed Apr 8 04:57:18 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 B5029C433FE for ; Sun, 23 Oct 2022 09:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiJWJxd (ORCPT ); Sun, 23 Oct 2022 05:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJx3 (ORCPT ); Sun, 23 Oct 2022 05:53:29 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29CD75CC2 for ; Sun, 23 Oct 2022 02:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518554; 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=hjKKqw3Bk3xbTfdsBUYQKJyI4PHiU8JemC2E70n/LOg=; b=0usJwLGZjJ+e/1Vb9BwWtfQuGR6MEwx+OK98wvscHh0B4ccXJYqJZ/svmM2+nwVOsZcK14 3HElOeLjAwv76sNkobr6+Pv2HjvnkDnOFBfra0DiDMsuGDuAnOe7cS8VwXXWGbJ77spbUR vJ6LBe/UdZBd6ijdOt0LvoNw+pmSzoo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 19/28] mfd: arizona: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:43 +0100 Message-Id: <20221023094852.8035-20-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Acked-by: Charles Keepax --- V2: Use new EXPORT_GPL_DEV_PM_OPS() macro V3: No change drivers/mfd/arizona-core.c | 19 +++++++------------ drivers/mfd/arizona-i2c.c | 2 +- drivers/mfd/arizona-spi.c | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index cbf1dd90b70d..bd7ee3260d53 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,15 @@ static int arizona_resume(struct device *dev) =20 return 0; } -#endif =20 -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) +EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) =3D { + 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) }; -EXPORT_SYMBOL_GPL(arizona_pm_ops); =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 Wed Apr 8 04:57:18 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 620D6ECAAA1 for ; Sun, 23 Oct 2022 09:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbiJWJxs (ORCPT ); Sun, 23 Oct 2022 05:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJWJxm (ORCPT ); Sun, 23 Oct 2022 05:53:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D4A2760E9 for ; Sun, 23 Oct 2022 02:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518555; 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=jS4RbK1fBZHnJZWsSL9bNObOtXdqrDwmB2EJvhOE5WE=; b=rtXmaloHsvGNzT2AB4fOw0XJ32A/93glRX494xsmj5xI3pald7gB9yu0TSeTydLWcu0Fgq 3L2+usa7H/VMv8RTwemGLTPJuYmdRPtiY67VWAndb6WY26Upa8rcVpp5sBtv0IBHMt9mkx Acd0H9jxZPGpkS8moPeJq3/bwvwBUG8= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 20/28] mfd: max14577: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:44 +0100 Message-Id: <20221023094852.8035-21-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil 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 Wed Apr 8 04:57:18 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 F0170C433FE for ; Sun, 23 Oct 2022 09:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbiJWJyB (ORCPT ); Sun, 23 Oct 2022 05:54:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJxw (ORCPT ); Sun, 23 Oct 2022 05:53:52 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE32857227 for ; Sun, 23 Oct 2022 02:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518555; 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=aDdXMBaOyK7oXLIUXU8KO8h1827AMeVClKPmuTxxjYw=; b=UVcgkd2hqBcVTDUblKW3Y+9nk5/fMeVVyGZYIWvhDzaCIWOkUxmwBQdyN3JQupoMFszBVp yI+asK4EPSJltpmZ7zS7Caj/JDgmv3A6Eva7yNng/Ed+fBnDg482KqaaeuLKQ0ThFT1T3h b6DQA5qDSaJPv3K1ERHiG5kKTzsyI1g= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 21/28] mfd: max77686: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:45 +0100 Message-Id: <20221023094852.8035-22-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil 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 Wed Apr 8 04:57:18 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 E97E9ECAAA1 for ; Sun, 23 Oct 2022 09:54:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbiJWJyI (ORCPT ); Sun, 23 Oct 2022 05:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJyD (ORCPT ); Sun, 23 Oct 2022 05:54:03 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90BA7760D4 for ; Sun, 23 Oct 2022 02:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518556; 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=fH7g4YysWMLgOSNDG15jV52CUiW7mUEZ75bQsRILO7Y=; b=Eo1izMgZo0Frd07iuiRf9vf0fPXjQWEKqIe+2Bb8/l1BPw7uYGD6XuUOmArqH5H2tabJWa uw/WwGE6sqa2b04ScoqkO0g6adnTgivFJn62wERiV03dp5Q6uXsq4yEprv0pRue1F6jXZX HKP/0H4faJWhV237ysdVPljtKQ0IC54= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 22/28] mfd: motorola-cpcap: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:46 +0100 Message-Id: <20221023094852.8035-23-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 ADF4BC433FE for ; Sun, 23 Oct 2022 09:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbiJWJyX (ORCPT ); Sun, 23 Oct 2022 05:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbiJWJyT (ORCPT ); Sun, 23 Oct 2022 05:54:19 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B35D076476 for ; Sun, 23 Oct 2022 02:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518557; 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=HDKUPQO6lE4XXrIyfPTsCACfjenryJXx0aNwhM3B1z8=; b=emy0dHpKCzzzV2d6eN5XL6pMwMOKRnbcF8B3DF48yPGB6RCBT0lAakFC2M8DNlRdHfd3z4 oZ+NsY6Jpo7DKT3HBJ7u6gLpoN0pYpTTyQfCi/5UyMnrTXjRS5skq4mfk1FONrpU/s5jE1 eU0DSuAO0RkZCs7DzJ2ohbT04udgHbc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang Subject: [PATCH v3 23/28] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:47 +0100 Message-Id: <20221023094852.8035-24-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 546E0ECAAA1 for ; Sun, 23 Oct 2022 09:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbiJWJyr (ORCPT ); Sun, 23 Oct 2022 05:54:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJyl (ORCPT ); Sun, 23 Oct 2022 05:54:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22409318 for ; Sun, 23 Oct 2022 02:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518557; 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=rf+V8WTFZDSAN+5ckAKYlLWjlRnrCdeSS0nl0u+Vh8Q=; b=dBj76baEE4f6P4L0pHYValJKIB5hlDqZDhP/pphi/81ZB1nbB3FxGzocUaMiHRga9OzRWG fhfVfhE+EQV/2WZMJ956KovllsLWcMhx3eSOLeZ5QU4+d3bJw2N+7WjRnI5S1rv+JsZYLV 4URyf6DLKZYGgMCKP4e29Kj0BdGI0zs= 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 v3 24/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:48 +0100 Message-Id: <20221023094852.8035-25-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- V2: remove CONFIG_PM wrapper around fields in private struct V3: No change Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org drivers/mfd/stmfx.c | 6 ++---- include/linux/mfd/stmfx.h | 2 -- 2 files changed, 2 insertions(+), 6 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, diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h index 744dce63946e..967a2e486800 100644 --- a/include/linux/mfd/stmfx.h +++ b/include/linux/mfd/stmfx.h @@ -113,10 +113,8 @@ struct stmfx { struct irq_domain *irq_domain; struct mutex lock; /* IRQ bus lock */ u8 irq_src; -#ifdef CONFIG_PM u8 bkp_sysctrl; u8 bkp_irqoutpin; -#endif }; =20 int stmfx_function_enable(struct stmfx *stmfx, u32 func); --=20 2.35.1 From nobody Wed Apr 8 04:57:18 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 D783EECAAA1 for ; Sun, 23 Oct 2022 09:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbiJWJzL (ORCPT ); Sun, 23 Oct 2022 05:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbiJWJy6 (ORCPT ); Sun, 23 Oct 2022 05:54:58 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3D022516 for ; Sun, 23 Oct 2022 02:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518558; 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=YSXFtUMP2239U1R0Zna0E84HFug4CfOI1c/yuHZa1WY=; b=QOwuLGThnniJS2rm7pVt7LxJYscZhBKEE7Tv34kOWnFNg4Qiz4BxDRIvnRFQJWm4Vjeave jRY7bIDtV1wqowQozXM0Zt9yfBDxihcCiPy9yhGzUSrj76q0r6YVLc1XMtj/Hs3oaYI4+C Oqz7GOeo7RU3/xKrtYb7ogh96xfqmGA= 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 v3 25/28] mfd: stmpe: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:49 +0100 Message-Id: <20221023094852.8035-26-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- V2: remove duplicated "const". Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org 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 0c4f74197d3e..c304d20bb988 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1495,7 +1495,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); @@ -1516,8 +1515,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 +EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, + stmpe_suspend, stmpe_resume); --=20 2.35.1 From nobody Wed Apr 8 04:57:18 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 BDE82C433FE for ; Sun, 23 Oct 2022 09:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230334AbiJWJzU (ORCPT ); Sun, 23 Oct 2022 05:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJzC (ORCPT ); Sun, 23 Oct 2022 05:55:02 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1491A64C7 for ; Sun, 23 Oct 2022 02:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518559; 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=/fNX/ttuDiI3uxQdqB3fB+Ou1WPOijArfObsH7/WKDQ=; b=wCCE0tHv8/OT2rcRBgCsOIsb3437XkIhFuiBPr9YpJrNSDMXXA6oO9VyoWbMBqyvqJWa+e hnE2TDg7GEmZw8xjJ4JmnZt19h7hj/VfXzqA4PIXll3DGb92Z3rdV+HNVACGJEQ6Vx3r5+ exZQ3XfFRab1Lt3oJtvaZMq8QTICq68= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 26/28] mfd: tc3589x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:50 +0100 Message-Id: <20221023094852.8035-27-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 Wed Apr 8 04:57:18 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 1AD4BECAAA1 for ; Sun, 23 Oct 2022 09:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbiJWJzn (ORCPT ); Sun, 23 Oct 2022 05:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiJWJzI (ORCPT ); Sun, 23 Oct 2022 05:55:08 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7863931EFF for ; Sun, 23 Oct 2022 02:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518559; 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=FKwp4R0sM21Ivi8navoOTJy75R51wyGPAcCybh3hh04=; b=lqSw4wxfbDVH/WSNC7MHZ2lbxkvreN4X8JVR+2SW39jHRtx3syR+/ZfcjjgpzZViqWyNrV LYVRYIqXS3oRKf7OdAxD8dI3q7L1kXI1SDAtFzQB/y/Q5PdQ1mnMa1BSFfMwRo1QHPd8z7 Et6ahhV6CTUWuhmbDXKLANHKt6DlQ/s= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 27/28] mfd: tc6393xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:51 +0100 Message-Id: <20221023094852.8035-28-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- 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 aa903a31dd43..997bb8b5881d 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -813,7 +813,6 @@ static int tc6393xb_remove(struct platform_device *dev) return 0; } =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); @@ -876,16 +875,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 From nobody Wed Apr 8 04:57:18 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 978D6C433FE for ; Sun, 23 Oct 2022 09:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbiJWJz5 (ORCPT ); Sun, 23 Oct 2022 05:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiJWJzX (ORCPT ); Sun, 23 Oct 2022 05:55:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944813EA77 for ; Sun, 23 Oct 2022 02:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518560; 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=TEQXKhpmuv4knhdIiLWQdn8XmCoEHRrn4b2xDe3I7q8=; b=vHksYpqY8Bg/aEpy6dWj761UxdGO2zSMJvI6genf6oow2CSnAucZx1N2i4ozanyrmB1f9j l3LDPVkiV9CvPlw+E/Sk0BUPEC0jT1tB9qFj3k2U4MgmxXCn2/Aa4U63pNrsimr1PGQuOX WMYU9iS/OH2TjkJSmkVvJRts/n+r1Co= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 28/28] mfd: intel-lpss: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:52 +0100 Message-Id: <20221023094852.8035-29-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-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_DEV_PM_OPS() and pm_sleep_ptr() / pm_ptr() macros to handle the PM callbacks. These macros allow the PM functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Note that instead of exporting two dev_pm_ops structures containing the exact same data, one in intel-lpss-acpi.c and one in intel-lpss-pci.c, we export one single dev_pm_ops structure from intel-lpss.c using the EXPORT_GP_DEV_PM_OPS() macro, which is then referenced from the -acpi.c and -pci.c files. Signed-off-by: Paul Cercueil --- drivers/mfd/intel-lpss-acpi.c | 4 +--- drivers/mfd/intel-lpss-pci.c | 2 +- drivers/mfd/intel-lpss.c | 15 +++++++++------ drivers/mfd/intel-lpss.h | 28 +--------------------------- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index a143c8dca2d9..1d46a7aa1c61 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -203,15 +203,13 @@ static int intel_lpss_acpi_remove(struct platform_dev= ice *pdev) return 0; } =20 -static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops); - static struct platform_driver intel_lpss_acpi_driver =3D { .probe =3D intel_lpss_acpi_probe, .remove =3D intel_lpss_acpi_remove, .driver =3D { .name =3D "intel-lpss", .acpi_match_table =3D intel_lpss_acpi_ids, - .pm =3D &intel_lpss_acpi_pm_ops, + .pm =3D pm_ptr(&intel_lpss_pm_ops), }, }; =20 diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c index dde31c50a632..28f4d3a5aae3 100644 --- a/drivers/mfd/intel-lpss-pci.c +++ b/drivers/mfd/intel-lpss-pci.c @@ -556,7 +556,7 @@ static struct pci_driver intel_lpss_pci_driver =3D { .probe =3D intel_lpss_pci_probe, .remove =3D intel_lpss_pci_remove, .driver =3D { - .pm =3D &intel_lpss_pci_pm_ops, + .pm =3D pm_ptr(&intel_lpss_pm_ops), }, }; =20 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index cfbee2cfba6b..9cdd0b52f8d8 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c @@ -468,7 +468,7 @@ static int resume_lpss_device(struct device *dev, void = *data) return 0; } =20 -int intel_lpss_prepare(struct device *dev) +static int intel_lpss_prepare(struct device *dev) { /* * Resume both child devices before entering system sleep. This @@ -477,9 +477,8 @@ int intel_lpss_prepare(struct device *dev) device_for_each_child_reverse(dev, NULL, resume_lpss_device); return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_prepare); =20 -int intel_lpss_suspend(struct device *dev) +static int intel_lpss_suspend(struct device *dev) { struct intel_lpss *lpss =3D dev_get_drvdata(dev); unsigned int i; @@ -498,9 +497,8 @@ int intel_lpss_suspend(struct device *dev) =20 return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_suspend); =20 -int intel_lpss_resume(struct device *dev) +static int intel_lpss_resume(struct device *dev) { struct intel_lpss *lpss =3D dev_get_drvdata(dev); unsigned int i; @@ -513,7 +511,12 @@ int intel_lpss_resume(struct device *dev) =20 return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_resume); + +EXPORT_GPL_DEV_PM_OPS(intel_lpss_pm_ops) =3D { + .prepare =3D pm_sleep_ptr(intel_lpss_prepare), + LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume) + RUNTIME_PM_OPS(intel_lpss_suspend, intel_lpss_resume, NULL) +}; =20 static int __init intel_lpss_init(void) { diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h index 062ce95b68b9..c1d72b117ed5 100644 --- a/drivers/mfd/intel-lpss.h +++ b/drivers/mfd/intel-lpss.h @@ -30,32 +30,6 @@ int intel_lpss_probe(struct device *dev, const struct intel_lpss_platform_info *info); void intel_lpss_remove(struct device *dev); =20 -#ifdef CONFIG_PM -int intel_lpss_prepare(struct device *dev); -int intel_lpss_suspend(struct device *dev); -int intel_lpss_resume(struct device *dev); - -#ifdef CONFIG_PM_SLEEP -#define INTEL_LPSS_SLEEP_PM_OPS \ - .prepare =3D intel_lpss_prepare, \ - SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume) -#else -#define INTEL_LPSS_SLEEP_PM_OPS -#endif - -#define INTEL_LPSS_RUNTIME_PM_OPS \ - .runtime_suspend =3D intel_lpss_suspend, \ - .runtime_resume =3D intel_lpss_resume, - -#else /* !CONFIG_PM */ -#define INTEL_LPSS_SLEEP_PM_OPS -#define INTEL_LPSS_RUNTIME_PM_OPS -#endif /* CONFIG_PM */ - -#define INTEL_LPSS_PM_OPS(name) \ -const struct dev_pm_ops name =3D { \ - INTEL_LPSS_SLEEP_PM_OPS \ - INTEL_LPSS_RUNTIME_PM_OPS \ -} +extern const struct dev_pm_ops intel_lpss_pm_ops; =20 #endif /* __MFD_INTEL_LPSS_H */ --=20 2.35.1