From patchwork Wed Jul 5 20:43:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 116429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2139102vqx; Wed, 5 Jul 2023 14:11:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlH9JwNrzbUtzyDybaReNw8i4QF1nursID5XdxmcMAIcPr7mxfUaexVOECkc1Sunp35Uh3xe X-Received: by 2002:a17:903:41c7:b0:1b8:b433:7fa with SMTP id u7-20020a17090341c700b001b8b43307famr185011ple.13.1688591484481; Wed, 05 Jul 2023 14:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688591484; cv=none; d=google.com; s=arc-20160816; b=bOj76Uc05PouUWXlWRI4MRl51H9AfA57IitcfXkchzodMub2AgTVgOjfkCQ073LuSE 4p8Z+0DSb1+Y0FnOlw9+wu8NpwDCYN2uqSIMEYuScvvxNgfG4DikEhifcGbT7kYGauDL 3enLSPf68XMxnNhw4k1RmLOu5zzSUNUd/8bxqNBCUhwbQ6zEP1Tmr8wN/pLVNJ6E+4Cw 0XJ4ooq16D7dbMAV8jHrtRUQow4YVxLUxJCTx4TQF2NYmQgo2ABOp3F2CzWPHyg/vuL0 jFky1o3K6KMNJIWsoGwmS6wqVSXsyvaGE7p6F0ybuP2BD94xAJzDcgGEFk0zvEJanXsm uR+Q== 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=X9yIGXHPT5jp8N9xR/28dXCRO2ICn60eWhZMTJMtiFc=; fh=h7isEsjyGfVaKg14U4G9w0MSC8+vXCr26znD1crDC0E=; b=KSvk1q/qA+44ak3LZV24GUeioyLL+Ppr0V1dsyZwc2q+6CfOITLwZhwgK2mzOierb0 Cb1s36ujXJ3S12t/CnysRQriHBI4LGJNzHSpqlguZtyfD9MMCU6v3ACY18ubiPbe+iWX S65ssYvq0uy+6xcHtxPvjGICQhGyBPxSG/GJVQxEGs5qi7SnoX9mzhXiHcaZDZQrEugr fp5A1tRYjviFlHIXNo+uZZ5xB81rVnwB36siA0uzaoRZdWFHeUG2SHBhhEjkRVM13Uuf 0dkyBGwsqm9198DbOG0U6ZU58XxljfeqYe/InZiKLx0/Jh5+P823cGod5fkIfWvPWI6I /YYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=fB+4mhTl; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a170903228a00b001b8b7460620si857303plh.181.2023.07.05.14.11.09; Wed, 05 Jul 2023 14:11:24 -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=fB+4mhTl; 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 S234007AbjGEUrp (ORCPT + 99 others); Wed, 5 Jul 2023 16:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234018AbjGEUrm (ORCPT ); Wed, 5 Jul 2023 16:47:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B7B51BC8; Wed, 5 Jul 2023 13:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X9yIGXHPT5jp8N9xR/28dXCRO2ICn60eWhZMTJMtiFc=; b=fB+4mhTlMVpe0N+hYq/Ezi20Lh6M7waKHsDwl8xAH4TQiqZihIDWfgWbFWMySliu2Ak7xS 40AAKZsBq+y2IFY6ZT5HDGdj+SjMMkg4OaNEDQ7jxjxJz4jMyrR0vqQ3c7sl+tgZrQeRrc 8pTUBAGqepJQMIdMQPh9j12q3WDkw5k= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Vladimir Zapolskiy , linux-arm-kernel@lists.infradead.org Subject: [PATCH 16/23] i2c: pnx: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:43:07 +0200 Message-Id: <20230705204314.89800-17-paul@crapouillou.net> In-Reply-To: <20230705204314.89800-1-paul@crapouillou.net> References: <20230705204314.89800-1-paul@crapouillou.net> MIME-Version: 1.0 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,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770616504642719024?= X-GMAIL-MSGID: =?utf-8?q?1770616504642719024?= Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are 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: Jonathan Cameron --- Cc: Vladimir Zapolskiy Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-pnx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 82400057f810..4ee7db512333 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -613,7 +613,6 @@ static const struct i2c_algorithm pnx_algorithm = { .functionality = i2c_pnx_func, }; -#ifdef CONFIG_PM_SLEEP static int i2c_pnx_controller_suspend(struct device *dev) { struct i2c_pnx_algo_data *alg_data = dev_get_drvdata(dev); @@ -630,12 +629,9 @@ static int i2c_pnx_controller_resume(struct device *dev) return clk_prepare_enable(alg_data->clk); } -static SIMPLE_DEV_PM_OPS(i2c_pnx_pm, - i2c_pnx_controller_suspend, i2c_pnx_controller_resume); -#define PNX_I2C_PM (&i2c_pnx_pm) -#else -#define PNX_I2C_PM NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(i2c_pnx_pm, + i2c_pnx_controller_suspend, + i2c_pnx_controller_resume); static int i2c_pnx_probe(struct platform_device *pdev) { @@ -763,7 +759,7 @@ static struct platform_driver i2c_pnx_driver = { .driver = { .name = "pnx-i2c", .of_match_table = of_match_ptr(i2c_pnx_of_match), - .pm = PNX_I2C_PM, + .pm = pm_sleep_ptr(&i2c_pnx_pm), }, .probe = i2c_pnx_probe, .remove_new = i2c_pnx_remove,