From nobody Sat Apr 11 21:30:04 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08226C19F2A for ; Sun, 7 Aug 2022 14:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbiHGO5U (ORCPT ); Sun, 7 Aug 2022 10:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234838AbiHGO4q (ORCPT ); Sun, 7 Aug 2022 10:56:46 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C9C425DC for ; Sun, 7 Aug 2022 07:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ptxIOClzXAvyxR50upmaEEEEVGTnNXiaXnvmeGjVdJ4=; b=u4bs5OnvS8gkLjBxVHjqdJqNLX3/rCNdwg+PVk2wXxXMd5958OCSHjh9HGfbjENCMjkiAX fZJTv6x/ko+EyEjCWcslV2XwUnsqzyutGpk0CQZU8avXye+fby5yP+I+m0nX/ckfssPpWY wf98k8JzSZHs2PPtf1SAeoPcaiUVz+4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 26/28] mfd: stmpe: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:45 +0200 Message-Id: <20220807145247.46107-27-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. The advantage is then that these functions are now always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Reported-by: kernel test robot --- drivers/mfd/stmpe-i2c.c | 4 +--- drivers/mfd/stmpe-spi.c | 4 +--- drivers/mfd/stmpe.c | 8 ++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index d3eedf3d607e..bf094cc9f9de 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c @@ -116,9 +116,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); static struct i2c_driver stmpe_i2c_driver =3D { .driver =3D { .name =3D "stmpe-i2c", -#ifdef CONFIG_PM - .pm =3D &stmpe_dev_pm_ops, -#endif + .pm =3D pm_sleep_ptr(&stmpe_dev_pm_ops), .of_match_table =3D stmpe_of_match, }, .probe =3D stmpe_i2c_probe, diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index ad8055a0e286..e9cbf33502b3 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c @@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver =3D { .driver =3D { .name =3D "stmpe-spi", .of_match_table =3D of_match_ptr(stmpe_spi_of_match), -#ifdef CONFIG_PM - .pm =3D &stmpe_dev_pm_ops, -#endif + .pm =3D pm_sleep_ptr(&stmpe_dev_pm_ops), }, .probe =3D stmpe_spi_probe, .remove =3D stmpe_spi_remove, diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index aeb9ea55f97d..a88cc1103589 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1508,7 +1508,6 @@ void stmpe_remove(struct stmpe *stmpe) mfd_remove_devices(stmpe->dev); } =20 -#ifdef CONFIG_PM static int stmpe_suspend(struct device *dev) { struct stmpe *stmpe =3D dev_get_drvdata(dev); @@ -1529,8 +1528,5 @@ static int stmpe_resume(struct device *dev) return 0; } =20 -const struct dev_pm_ops stmpe_dev_pm_ops =3D { - .suspend =3D stmpe_suspend, - .resume =3D stmpe_resume, -}; -#endif +const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, + stmpe_suspend, stmpe_resume); --=20 2.35.1