From nobody Wed Apr 8 06:45:12 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