From patchwork Sat Jul 22 11:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 124307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp780464vqg; Sat, 22 Jul 2023 05:39:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlEnGw3wtHN54PHyI2SMkdrIe/fI0L9xygPFsrj0GcPDzIi3PXyWRllbBIhHvwhoxfAb82Pe X-Received: by 2002:a05:6a20:9194:b0:138:1c5b:22fc with SMTP id v20-20020a056a20919400b001381c5b22fcmr4353998pzd.54.1690029553858; Sat, 22 Jul 2023 05:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690029553; cv=none; d=google.com; s=arc-20160816; b=aPi6ExCFW2SQ7dLAn8VoHnDUTCmxQB2s/A/DQQYKaRFYO1SLN/CzswkF0aWwl5DUF3 TSaZFUvgecLkMg4MRtQ2ma819qQbTxVljkzkwgZFXw6xUkTw1ENXmR4b5u2RecnN/fPM SM3ZfiTGplq10LSB8WTbNDB4/hVVwSs8Zi37kfzdFIkqPcSjOGHckG+4gZhZpTF1EPhk fZmc8NmsH30UairA8JLQ3n6maIK690xDBBU8AbMMDDWkDY3qQPP+ZD7LJ4GSShrsQeiI GmsNimIYSAoKQfaqJMC/m2AZFoEWXehj70rzywFqwUL3IHL5rEqXI787SbhKlNiJkeGx iFHQ== 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=K1kXVJYmeYFGDk1jOMEZ/tC/buoxy4+qLy2zmLpTzDA=; fh=bjkJn10HtVIDLBN8x3sMTe0vOVBmH5MlozdGCD/oD/s=; b=gsLSWeKaU1GXubA5illtXT5W4UsNlTx+BZWCA1XfsknHu9dReNU+xE74D9XBOP9g48 dN66+1eLgYLpgj9B7bX0PiEuvU8nDAzNhF33gmuoubqjVFcfrwf01FL5BvOgTJWoMwgi zsKAjNoE4gVJBQDc9oqav37nx1zwATi7PtcIoj/rnGk+asKxuKiPpuC+QjljKEOEw2Xp qGvZF0lsFzw9gxURC/PqEHFrfbBJBkhAXmEJ19MZ+HurbdHhC/WrPR5MuxzQWaxX6Kfr HFqSjnA14iUalapH4NBg3gf2Z6In0MuyU4ViGxhq1oudY2wYAD/Rw3uQ7lpOU7mKB3/L JU4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="i1/AC2mE"; 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 h24-20020a63f918000000b0055baf9fc385si5120555pgi.302.2023.07.22.05.39.01; Sat, 22 Jul 2023 05:39:13 -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="i1/AC2mE"; 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 S229652AbjGVL6K (ORCPT + 99 others); Sat, 22 Jul 2023 07:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbjGVL6H (ORCPT ); Sat, 22 Jul 2023 07:58:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF0CB185; Sat, 22 Jul 2023 04:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026686; 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=K1kXVJYmeYFGDk1jOMEZ/tC/buoxy4+qLy2zmLpTzDA=; b=i1/AC2mEsJ/+3v8VXsJj7b5qxQCSPhPpXMsSkM1WKYcx/atu7FEWHrwJbkbJNaNLmwr4Fn wOoS3UGuAPu5rJgo+8dp6VZuOXjy9xKcryvGL6RT2QaTe5DYNE4zHDdOUTERRhqGerOTfA EqLGbBpljEoTA9PVM7+7rzf1WRXJ5RU= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jonathan Cameron Subject: [PATCH v2 16/22] i2c: pxa: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:40 +0200 Message-Id: <20230722115046.27323-17-paul@crapouillou.net> In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net> References: <20230722115046.27323-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: INBOX X-GMAIL-THRID: 1772124429486351116 X-GMAIL-MSGID: 1772124429486351116 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. Note that the behaviour is slightly different than before; the original code wrapped the suspend/resume with #ifdef CONFIG_PM guards, which resulted in these functions being compiled in but never used when CONFIG_PM_SLEEP was disabled. Now, those functions are only compiled in when CONFIG_PM_SLEEP is enabled. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron --- drivers/i2c/busses/i2c-pxa.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 937f7eebe906..65a18d73be5c 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -1491,7 +1491,6 @@ static void i2c_pxa_remove(struct platform_device *dev) clk_disable_unprepare(i2c->clk); } -#ifdef CONFIG_PM static int i2c_pxa_suspend_noirq(struct device *dev) { struct pxa_i2c *i2c = dev_get_drvdata(dev); @@ -1516,17 +1515,12 @@ static const struct dev_pm_ops i2c_pxa_dev_pm_ops = { .resume_noirq = i2c_pxa_resume_noirq, }; -#define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops) -#else -#define I2C_PXA_DEV_PM_OPS NULL -#endif - static struct platform_driver i2c_pxa_driver = { .probe = i2c_pxa_probe, .remove_new = i2c_pxa_remove, .driver = { .name = "pxa2xx-i2c", - .pm = I2C_PXA_DEV_PM_OPS, + .pm = pm_sleep_ptr(&i2c_pxa_dev_pm_ops), .of_match_table = i2c_pxa_dt_ids, }, .id_table = i2c_pxa_id_table,