Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29565721rwd; Wed, 5 Jul 2023 13:58:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGiursKDc3vAMHGvL7d3/4AakWlSoMoI7Q45XdSmE8e5ISB1W86koymqxw+OQmBFdtN7y1k X-Received: by 2002:a17:902:ea05:b0:1b6:8a99:4979 with SMTP id s5-20020a170902ea0500b001b68a994979mr120432plg.22.1688590731087; Wed, 05 Jul 2023 13:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688590731; cv=none; d=google.com; s=arc-20160816; b=tyjFa9ZpGFMux6GzpuzMNO7Nyd/0j+7QmM7r7Cs6H1mgPOS4k56bgEOpsJ9UiDipRo FMIXoci9DcPcLGBAH1aZqHJC8Vqyv3ugT/HNkXoeRS/St0F54f9VECgOHLz6+ERTB/bD aRiHCkWx8epV4NDxLGQFRHpNEGdbOVXsscqEYiFiz17Z4vOo6Cgz8tQPmjVGJa5tnkue RTvBmupL6MWPeCQTiFW4gC5OWWoccHA+NK28Hiwj198aALKkCBFtu9dOs7LVB4l5+Fak zlXdSBZ5j9UygpUGrAvals/d/RsO3ugnGKwVGqiTWUZfOsFgp6NhLi8NG2k+9rSRPbTq Ud6Q== 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=I3lBz+eaIN5N2MwzF2q9zx4C6GRahQdn7x/nnKH54Gw=; fh=lwjyloP9a7ffUiC6NqFxv6702m7ec43pO6ZS/VeCvMc=; b=JlWf3JS6ZQJ2R364PCf40KB+VskzuGTY3zQMhCOVO8Nr5rA6ADHAJNnr0jYWFDg0Al pekKJPyTcugGDO148OxqagyGdUbLJ8BqExFPchYJYHb0edlB4wosB+QeDCcslKFpG+um vlKihAu6kWSD057Olsk/WXuAqdc4h6MPVXqo9rWIJfGJRz5sMbYnZdJD/EdgeQFD2ZYb rtNy6lVEmMfqalrp6qQ+KxD3M4mZS0fOplF1rzwryBUIiAx4zV7JOpEUHT6d0TnYKzmY Sjj+bAO0Q1E/5syz+5QEun82eIrdJbVAkGOoNp2l6XPahm9L+cV7MvbaxyCoKuWidHMx Wzzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=bvryjvSj; 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 e7-20020a17090301c700b001b878f9e11csi12930122plh.54.2023.07.05.13.58.37; Wed, 05 Jul 2023 13:58:51 -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=bvryjvSj; 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 S233923AbjGEUpf (ORCPT + 99 others); Wed, 5 Jul 2023 16:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbjGEUp2 (ORCPT ); Wed, 5 Jul 2023 16:45:28 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A1219AC; Wed, 5 Jul 2023 13:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589819; 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=I3lBz+eaIN5N2MwzF2q9zx4C6GRahQdn7x/nnKH54Gw=; b=bvryjvSj9Bt4CNYeaGGuaK4QMzJkNBn/wfxOn1JI186QyIVi08g4QQQuEJAFDgl51OUrnq +qLq8QXhw+yZa4/FW0AObdvZuGJPGrbhpX8JTFHNCRbVnXJyphuxC3rxFbwuZOzc55Cc2b rrukYEM9QclIsOFyuLxYSxg4X6u11Ps= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros Subject: [PATCH 06/23] i2c: designware: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:42:57 +0200 Message-Id: <20230705204314.89800-7-paul@crapouillou.net> In-Reply-To: <20230705204314.89800-1-paul@crapouillou.net> References: <20230705204314.89800-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,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 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 --- Cc: Jarkko Nikula Cc: Andy Shevchenko Cc: Mika Westerberg Cc: Jan Dabros --- drivers/i2c/busses/i2c-designware-platdrv.c | 22 ++++++--------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 970c1c3b0402..855b698e99c0 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -418,7 +418,6 @@ static void dw_i2c_plat_remove(struct platform_device *pdev) reset_control_assert(dev->rst); } -#ifdef CONFIG_PM_SLEEP static int dw_i2c_plat_prepare(struct device *dev) { /* @@ -429,11 +428,7 @@ static int dw_i2c_plat_prepare(struct device *dev) */ return !has_acpi_companion(dev); } -#else -#define dw_i2c_plat_prepare NULL -#endif -#ifdef CONFIG_PM static int dw_i2c_plat_runtime_suspend(struct device *dev) { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); @@ -447,7 +442,7 @@ static int dw_i2c_plat_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused dw_i2c_plat_suspend(struct device *dev) +static int dw_i2c_plat_suspend(struct device *dev) { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); @@ -468,7 +463,7 @@ static int dw_i2c_plat_runtime_resume(struct device *dev) return 0; } -static int __maybe_unused dw_i2c_plat_resume(struct device *dev) +static int dw_i2c_plat_resume(struct device *dev) { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); @@ -479,16 +474,11 @@ static int __maybe_unused dw_i2c_plat_resume(struct device *dev) } static const struct dev_pm_ops dw_i2c_dev_pm_ops = { - .prepare = dw_i2c_plat_prepare, - SET_LATE_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume) - SET_RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL) + .prepare = pm_sleep_ptr(dw_i2c_plat_prepare), + LATE_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume) + RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL) }; -#define DW_I2C_DEV_PMOPS (&dw_i2c_dev_pm_ops) -#else -#define DW_I2C_DEV_PMOPS NULL -#endif - /* Work with hotplug and coldplug */ MODULE_ALIAS("platform:i2c_designware"); @@ -499,7 +489,7 @@ static struct platform_driver dw_i2c_driver = { .name = "i2c_designware", .of_match_table = of_match_ptr(dw_i2c_of_match), .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match), - .pm = DW_I2C_DEV_PMOPS, + .pm = pm_ptr(&dw_i2c_dev_pm_ops), }, }; -- 2.40.1