Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5041789rwb; Mon, 8 Aug 2022 11:04:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gnnQP+zEw1pTRDDkULlu1BcHuanvh8uszTkcxZcj03ErLaS/kp+CBkZMA+4O9PqxWwv70 X-Received: by 2002:a17:903:449:b0:16d:d781:313a with SMTP id iw9-20020a170903044900b0016dd781313amr20018167plb.75.1659981881364; Mon, 08 Aug 2022 11:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659981881; cv=none; d=google.com; s=arc-20160816; b=lbbIDf9LFjVBTGlGZPQllNr10iLB+qS2GzcPX412PRVhsPBD3U2tCjq7PmKBbZoPwX WETfQp42orDdcKCF+J67F0KLL1hI4p0T+Azbb0kBXFK1WLTT4AGoIe/OpDd9KJiGT7+s IUK95HpklxuJFCgpRjvda3AGXSNbP/kUKvzosV61WU8/pZAdCXgclTMv5fxUbhcaNVwc d8vr/WNReU20IExrMPJmySjmA/SrnvzaFuL1FcStfa4T5YFyaBR4drR1QYwPzIM6sKAD 710fKWDGKiCkMzeZPTpSBFT1UiArnvQ1dzV4R8Ghtqh/LYwICX+G/jI9KYc/up48whL+ S4+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MyfIVzDAtyS9hNaCn1YQzhz/dCI8btmYd/18EkdPbzo=; b=kznebIlYXmauEC+U3Xp/HHeWLEklwJ+WCHrU99Lebe/ZAv4vEZa5CK6WDwWSjsDkdB CffvTzx3QjX9/oASNyZeDZ2MRqU5mag4vqWjHcxJZqoaHKE0ljesa+vYxPY/NbmcGjUu l8BR12bgV/SDh56gglHtmeytbbwXm9aOzuqYGSOKOp4oUChOUctzoe9RmvkhNC07IqjG NcEc5ZeOsd/sntu2M0+WqtRu04wbPqd6PzQt3vtepNkrrIYFzoTwKWhEyp4LdYD4NYaR LAFrLmlOjPosBdSdjwIwZArlPZkzd93E/qQRmgyyM2hfvliVHUXDV5Sl59Ou9KacgXGf uzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=0qjLM33Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u63-20020a638542000000b0041c7195c422si10669453pgd.187.2022.08.08.11.04.25; Mon, 08 Aug 2022 11:04:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=0qjLM33Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243928AbiHHRrz (ORCPT + 99 others); Mon, 8 Aug 2022 13:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243879AbiHHRqH (ORCPT ); Mon, 8 Aug 2022 13:46:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B5917A9D for ; Mon, 8 Aug 2022 10:45:29 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.35.1