From patchwork Mon Aug 8 17:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12938936 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2F86C00140 for ; Mon, 8 Aug 2022 17:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2+qKgpGWGZLqf7DJ9FSTm9NcCy+JfysoRdakm/9KHh0=; b=OJddDLPbEFa73n kCpn9ByzeG+uQtt43RI3nOTGBfxC4BkIEyRfyzmHcZV+u/HD6zUsLR1qQO2xiMGI+pU1vp8+wVn3H wIW/yVpL/S8zf/xNBGN3KuO/LS5aufy03NXnv/nvPnllu/MgAOMQfeE52xN0x7lOvp/tY9/1aDRHa u95iRMeSgcyI+XXs1eFZWWpo1txrIss5hawFk7BvVh5Fle0c0oz0lIGwvmTGVJEZv+6Kwb4qzP0OP ALcYfDzTN6PD1E+aQ1HbHySVZPC4E240b5mTAcYhy0+7oHgmFMX36PnVRACD9IObksM8H7jTKmV7O M4hwOBYgMpQsWDHy0uqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lF-00FCea-Jm; Mon, 08 Aug 2022 17:41:53 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lC-00FCb8-Tc; Mon, 08 Aug 2022 17:41:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659980502; 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=OXQCBo5FXH3fsXQ9+jXS+adX5jJl+ptBHGO+bKbqmuBed2aNPbhhG+XfoBUGT8AStcGh/m 8N6GjMmv+7Lx+6RmNMie2G30HNSqNVG94+Cy+v7zNJknFf3YEO63iSiAvSzPLKLm4WGFei OMtKwTQWAo3e8MluzcOTDgAIGnDoSGM= 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 v2 06/30] mfd: mt6397-irq: Remove #ifdef guards for PM related functions Date: Mon, 8 Aug 2022 19:40:43 +0200 Message-Id: <20220808174107.38676-7-paul@crapouillou.net> In-Reply-To: <20220808174107.38676-1-paul@crapouillou.net> References: <20220808174107.38676-1-paul@crapouillou.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220808_104151_164457_1B892573 X-CRM114-Status: GOOD ( 11.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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] |= BIT(shift); } -#ifdef CONFIG_PM_SLEEP static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) { struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data); @@ -68,9 +67,6 @@ static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) return 0; } -#else -#define mt6397_irq_set_wake NULL -#endif static struct irq_chip mt6397_irq_chip = { .name = "mt6397-irq", @@ -78,7 +74,7 @@ static struct irq_chip mt6397_irq_chip = { .irq_bus_sync_unlock = mt6397_irq_sync_unlock, .irq_enable = mt6397_irq_enable, .irq_disable = mt6397_irq_disable, - .irq_set_wake = mt6397_irq_set_wake, + .irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake), }; static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg, From patchwork Mon Aug 8 17:41:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12938937 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 507FEC00140 for ; Mon, 8 Aug 2022 17:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H7EA/uYiNSJigNIa2/b7AeM2K3ep6o+jf5tZa5hAH9k=; b=XVij0S0kEPBlcy /VMq+yCY/j4h4tRc0frbdBc55rCUT3UeVrOQe0JKKW4xrcSL8P6UbT/Fx1qa9lA24dirbbS2Bp6oR JkU1qNTg1lvuAFwD0rr4qeIlP7ZMx/vKD1o+8POW1PSTVz5gStv/EUfVmbbJEprqkuDujhkS8OfSb An3PW/s0Q6ZetSaRC/NZsW3AVQxKTKNpLTwaDx5gYrZfbQG+TlC4b1KPD8Px2GWRbe1MNZCZWPsY4 of/VOKIYipxebSLYqeAJPuebrY1DhvLoDGaBKXyzobJKksa8EsRXRSH+JukVQoxdleg4tG366eANW ZFDYOjhCFkgxeTihkVlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lV-00FCmz-Mn; Mon, 08 Aug 2022 17:42:09 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lS-00FCjc-4o for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2022 17:42:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659980507; 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=Z0TOf7NCTCNZLEJUd0n3YWp93p2MEOQ2XhRWmHJulpk=; b=rMgv++6XK2xdJknO31ryPaoawJDkx77mVzmGwzj1bCiQbqPpOKQuY7Snak2IVPYIeIcZTX J/6sWTX0o9bKJSo7eIPrlIm9B6LAPwIKxrng0Kwg4o6n0IuTTfMoytD0WULKBOEuD9zKN6 h2ctYA8WDLGslUmH4V0KrHt1I7BVoQ0= 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 v2 26/30] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Mon, 8 Aug 2022 19:41:03 +0200 Message-Id: <20220808174107.38676-27-paul@crapouillou.net> In-Reply-To: <20220808174107.38676-1-paul@crapouillou.net> References: <20220808174107.38676-1-paul@crapouillou.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220808_104206_389200_51B09D64 X-CRM114-Status: GOOD ( 13.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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; } -#ifdef CONFIG_PM_SLEEP static int stmfx_suspend(struct device *dev) { struct stmfx *stmfx = dev_get_drvdata(dev); @@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev) return 0; } -#endif -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_resume); static const struct of_device_id stmfx_of_match[] = { { .compatible = "st,stmfx-0300", }, @@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver = { .driver = { .name = "stmfx-core", .of_match_table = stmfx_of_match, - .pm = &stmfx_dev_pm_ops, + .pm = pm_sleep_ptr(&stmfx_dev_pm_ops), }, .probe = stmfx_probe, .remove = 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 }; int stmfx_function_enable(struct stmfx *stmfx, u32 func); From patchwork Mon Aug 8 17:41:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12938938 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C6FAC25B0C for ; Mon, 8 Aug 2022 17:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oFWz5zagJUS7IfAQuJ7t9zgfzoYxoYdlDOaxtkNHZ3E=; b=fJMGEC1s2VsGYY dYdKVgmKBuIlIGyLtrf134mvZPQ/gRSAxqRwSMTnCeJEl3R/n65bJ1JsIB2+PuDBJjyem5NEAZcxr j2Lv1bHQC5XkKbvwnjRRRjsLSwFsUjrvoE4yQqaA9cEL54obF0RriUFHkI3kVaezC4AvX7des85lQ cRxq8pEHufDB1jAAB3rl5TVSwUg8P8Vg5zgmAhNuSCCbGWjOtlQZ/9fV+syC6xAAqNyzY1LOUARqF io29DVpFbYePDlsuBo4s6dbgM+8UProE+sxeRbaRRJDZidJykE0kdpjkSF2dxNBRD3j7PcCB3IqWl 0EtVwWLoHPA/5hNSLl4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lf-00FCrr-BR; Mon, 08 Aug 2022 17:42:19 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL6lZ-00FCpC-ST for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2022 17:42:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659980507; 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=MyfIVzDAtyS9hNaCn1YQzhz/dCI8btmYd/18EkdPbzo=; b=0qjLM33ZN78rAyxl5Ult69Aag/DNLTqw1GpoeCuiYoyOQG6qKJh2ww5gStMaysCI8iAD5w zWRuQMDH5GvdAxxsWR2AviEyWynKFP460/0GLI3aXYkl/uV5UgqJdD4tJ7tOREWpwDFPuL xa1ixTyhbCVNKRNxi9Zeh85ScXqb3fI= 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 v2 27/30] mfd: stmpe: Remove #ifdef guards for PM related functions Date: Mon, 8 Aug 2022 19:41:04 +0200 Message-Id: <20220808174107.38676-28-paul@crapouillou.net> In-Reply-To: <20220808174107.38676-1-paul@crapouillou.net> References: <20220808174107.38676-1-paul@crapouillou.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220808_104214_095093_59BA1D58 X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 = { .driver = { .name = "stmpe-i2c", -#ifdef CONFIG_PM - .pm = &stmpe_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), .of_match_table = stmpe_of_match, }, .probe = 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 = { .driver = { .name = "stmpe-spi", .of_match_table = of_match_ptr(stmpe_spi_of_match), -#ifdef CONFIG_PM - .pm = &stmpe_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), }, .probe = stmpe_spi_probe, .remove = stmpe_spi_remove, diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index aeb9ea55f97d..89ffd5a7fab8 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1508,7 +1508,6 @@ void stmpe_remove(struct stmpe *stmpe) mfd_remove_devices(stmpe->dev); } -#ifdef CONFIG_PM static int stmpe_suspend(struct device *dev) { struct stmpe *stmpe = dev_get_drvdata(dev); @@ -1529,8 +1528,5 @@ static int stmpe_resume(struct device *dev) return 0; } -const struct dev_pm_ops stmpe_dev_pm_ops = { - .suspend = stmpe_suspend, - .resume = stmpe_resume, -}; -#endif +EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, + stmpe_suspend, stmpe_resume);