Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29578450rwd; Wed, 5 Jul 2023 14:09:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlEXtjBMiGXSZTeUisPllmAYZkhxNw62Olex5taizvRNa3efBm9s8tmDVIzHj/dQ0YwixMtg X-Received: by 2002:a17:902:f814:b0:1b5:3c7f:1b3b with SMTP id ix20-20020a170902f81400b001b53c7f1b3bmr98331plb.35.1688591382631; Wed, 05 Jul 2023 14:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688591382; cv=none; d=google.com; s=arc-20160816; b=GGfA5HAe9Vt0PeDLWIDBJWJWmT5rBgyXJiDsIWA6dQkSzGg70sE0lkmDDKx9sAE65B moO4efVBFXpCnR4KGUGkFycgUICSYBUQI6LAbB1HOKHm0kHg7hvNLjypJFW5+/0usZGl iXy/sGpEwXSItu0AWa8lqH17y+sALGRb+R0dERLm6T+hi/JlRtgkc+VsvFeWGNsgybmy zhlIf/qLbIHlTo410FQymLqFPhEF0/Wz7vGMmiOiILcNhm6T6QXcUGCsgYHTrdgvVDHE XnYr3MwMbqZpr1ddhYdwyD/i/6RguOW/EFTshosOFAVGWVUb+yxgRa5ohCOl7qvf+Q/h OazQ== 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=RXJgywPeFQIZsX3zNLHXatymfwmLlaoyfLAvc1Jf4PU=; fh=U9841g4EUCAPeoDM/UJn+oMNlD40sdp2F9NT7lnJYnA=; b=sMsWPqHAkLXx9RI/iB2M16O6zMUtQPsLF6gachhEW9Oa3lVoCGWgjM+chdbDTzzeJl WK4J/c+V/sUchsKBL2oY4PiOBHZVWUZXvTEVuWvSu3j3iT879JMKM6but3jeb3fJgMck sVoO5rVIeQD/cEpmlDz96jtOP0N6OhRlCuZWv1MmWq62pqUYZ/R/ODeHi79F29oXtHfw jxE8B0e+Hge2inb/cRFEHZujzrp5sRQcMgoWac0fw0s6HAl+eUrpDjsCZo4UImgweFMm zR3Pio7Av9IZSJ9mTvNHaIv+olAARvSFhPYpIWo98EK2gK4E12d2cdd5aIcYvJ/xr4dP y0Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ucAnSAvq; 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 ij25-20020a170902ab5900b001b878feaec7si11271117plb.203.2023.07.05.14.09.27; Wed, 05 Jul 2023 14:09:42 -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=ucAnSAvq; 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 S233971AbjGEUrc (ORCPT + 99 others); Wed, 5 Jul 2023 16:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbjGEUr3 (ORCPT ); Wed, 5 Jul 2023 16:47:29 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B2A1BF4; Wed, 5 Jul 2023 13:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589829; 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=RXJgywPeFQIZsX3zNLHXatymfwmLlaoyfLAvc1Jf4PU=; b=ucAnSAvqtYwAMzmoTP6adGDl8JpLc96EI/xHChnawNNSVqq7fqQkijEerYSvPzR69qTBbg O1PzzsLKp8M9oeIaqpKE76NP3SoDieq6CCtFFSWgJE/RoBnxvObohtvLKBGzi5mRYPwOH7 IxhCPa8LldN/LceeIb7xlPkAKn+gKUw= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Peter Korsgaard , Andrew Lunn Subject: [PATCH 15/23] i2c: ocores: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:43:06 +0200 Message-Id: <20230705204314.89800-16-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: Peter Korsgaard Cc: Andrew Lunn --- drivers/i2c/busses/i2c-ocores.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index 4ac77e57bbbf..041a76f71a49 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -743,7 +743,6 @@ static void ocores_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&i2c->adap); } -#ifdef CONFIG_PM_SLEEP static int ocores_i2c_suspend(struct device *dev) { struct ocores_i2c *i2c = dev_get_drvdata(dev); @@ -772,11 +771,8 @@ static int ocores_i2c_resume(struct device *dev) return ocores_init(dev, i2c); } -static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume); -#define OCORES_I2C_PM (&ocores_i2c_pm) -#else -#define OCORES_I2C_PM NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(ocores_i2c_pm, + ocores_i2c_suspend, ocores_i2c_resume); static struct platform_driver ocores_i2c_driver = { .probe = ocores_i2c_probe, @@ -784,7 +780,7 @@ static struct platform_driver ocores_i2c_driver = { .driver = { .name = "ocores-i2c", .of_match_table = ocores_i2c_match, - .pm = OCORES_I2C_PM, + .pm = pm_sleep_ptr(&ocores_i2c_pm), }, }; -- 2.40.1