From patchwork Sat Jul 22 11:50:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 124285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp759993vqg; Sat, 22 Jul 2023 04:56:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxMmYP84nqj4q2JFHCWl0bncFha0kP/TajWF8W753sdkqvwiOpsCFbRR5QB7uSEW2EK0Lu X-Received: by 2002:a19:4307:0:b0:4f8:6627:7983 with SMTP id q7-20020a194307000000b004f866277983mr1933763lfa.5.1690027005431; Sat, 22 Jul 2023 04:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690027005; cv=none; d=google.com; s=arc-20160816; b=MfYozpThCdzqR04RUINdli/eqqy/HLU/hmKT3+tTQl8z+KkoHxNsOwsYKWCBMXQiOj Q9xdmGiPT/tQeCCwgCcq3BughijQr36TWCqRs2UfUrCxsRVsFRRAErIQ9Gp34/pG4Nsp fN4NDKmmgcs3tixDlwEjHpfPRkSiqR1xDKd5Aa2Zbt4Xe1+dDXCu8BOCkHJ/1PMKgiFO Vw7HbnyqnPONnf2gptQ4gG1DN0YX8LD6uWPWS35tVB1GYcoRSRU/hn0duEk0i1PJeq4e SyklkTSN4IE6f/pBeJjsA+Ze+8wtwP8OUOW1bQcChCS+E9DKtumI/fuFY/ZAy9WZ+esy /8oA== 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=g/BBHyhsIwL5x6ORlnBGuc1DVgxLu4u2Um9etjPPMEA=; fh=4O65vcdT+xsOx89OF7RAacnka1rppBnuWxNqgpNpNxc=; b=vFZKIpTpEPNhno8MbA5wMgfnyJhQOxgkCbQJ8btrAEh6M0H0nEj9GSFvroyVA5gnmX qysKmc1wEOQf8fCg7RFrd10Vzx1u9qHR+DxsSVf5LTPI2swn3DmE95az4x9AG6VcU4cX pvD5Of234Md/dL3EnRy9QIGQ/4HoC7vCSXAQJZh2lH3kDGX11JyrfrInRKE+aBW5ZITP MbHKx6IbZKrHA9FB98W5wcvDN6PldCyPo+EGDWuEvIEQXRlYW7WXw0qZZPuBfyZVXMso DREMSb9I1Vetaf+yEDZglQjAEXF/w+nmaNakmOM12eNkP/uh39SgufJGRiZnol2Qv66t uFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="DR+/6e2+"; 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 m4-20020aa7c484000000b0051df225e708si3776777edq.46.2023.07.22.04.56.21; Sat, 22 Jul 2023 04:56:45 -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="DR+/6e2+"; 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 S230078AbjGVLwT (ORCPT + 99 others); Sat, 22 Jul 2023 07:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjGVLwQ (ORCPT ); Sat, 22 Jul 2023 07:52:16 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D66D35AC; Sat, 22 Jul 2023 04:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026665; 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=g/BBHyhsIwL5x6ORlnBGuc1DVgxLu4u2Um9etjPPMEA=; b=DR+/6e2+kloqXAiVLNghryYU4F9lPdyBVWb9WOSVfSN9VfGa2JZ4UIiE2ckPnUZmt4j5eP oPCpcc3vTlCg3MmUySSs4Kq2lXrx6gMwWIxrtmt4NuIDvGrwJMiCIh51/bT/eDKdX/pVhL mQhxMHXJ09xWFm4t/lm0f0BKNrgxl5g= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jonathan Cameron , Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 04/22] i2c: davinci: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:28 +0200 Message-Id: <20230722115046.27323-5-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: 1772121757177578328 X-GMAIL-MSGID: 1772121757177578328 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 Reviewed-by: Bartosz Golaszewski --- Cc: Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-davinci.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 71b60778c643..52527189a7bf 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -902,7 +902,6 @@ static void davinci_i2c_remove(struct platform_device *pdev) pm_runtime_disable(dev->dev); } -#ifdef CONFIG_PM static int davinci_i2c_suspend(struct device *dev) { struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev); @@ -926,15 +925,10 @@ static int davinci_i2c_resume(struct device *dev) static const struct dev_pm_ops davinci_i2c_pm = { .suspend = davinci_i2c_suspend, .resume = davinci_i2c_resume, - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; -#define davinci_i2c_pm_ops (&davinci_i2c_pm) -#else -#define davinci_i2c_pm_ops NULL -#endif - static const struct platform_device_id davinci_i2c_driver_ids[] = { { .name = "i2c_davinci", }, { /* sentinel */ } @@ -947,7 +941,7 @@ static struct platform_driver davinci_i2c_driver = { .id_table = davinci_i2c_driver_ids, .driver = { .name = "i2c_davinci", - .pm = davinci_i2c_pm_ops, + .pm = pm_sleep_ptr(&davinci_i2c_pm), .of_match_table = davinci_i2c_of_match, }, };