Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1041031rwo; Sat, 22 Jul 2023 05:33:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlFzqnZ7Zftej3jVutocCa81ElgJ8/PBIp1cdGl6NmHUv4maN3g8dnDub2Ds2SXtj8BjWDRD X-Received: by 2002:a17:90a:bf81:b0:267:6fd0:bd31 with SMTP id d1-20020a17090abf8100b002676fd0bd31mr6990898pjs.7.1690029229688; Sat, 22 Jul 2023 05:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690029229; cv=none; d=google.com; s=arc-20160816; b=FDPPSCQvEQWUB03W/VBFNrKS07mnuSw+VaZOJtk1UmKXMpKxkA/9o8478NsjeCgh+3 pFWuL+xh4I4oIAhmBmmEn24SlS8rInzKwDNrVfj3NIMPfFr9J+inkXk9qwBM4kPSxbDh 1xFXi+d9i5WdFVwgGn2nAVkiIzBRM2DRPG9D7mTDJblj+6dzp1uMYKM8wlMe25/QMGdW cY4xlVPI5sgSQoNJVtOY6PlcFVs6QKh0HT1H2cK/n9J0mpIygag9TchHc0JMB1ndLShf RU71jfdisn68jYcofhXPsE5sviS5PUw5IRMsUfF9dILKMrP9raFkB8xYcNwvtJb8O0fa UmcA== 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=vWjncXjiCmOApnwrSM4Cd6iO/mHi8UOW3/VBKdasyw8=; fh=mCCTNV9c2VFJgNmvBJ3wG+S5wXi9uCz2rJ9TXCmqkDo=; b=qYbPpN1tR846835aGnfm98rxj8L+dMC80hNITYrA7T1Jnb7UfMInNuFzs6P4WpUGqr 3YEzahrbcMGVrGQtifSpOPQxBODk9xb2koD9O/OPOQWb7NORsbl6khWpE3cac5vvWvTB bvmZ1vIZHUA2WQVDdshS56hU6OzOWFBUw6mp6UrtixTRGR19ThoumoWjrpgqNCDtBz9U mbjfEsbcMHWQ158uo4noZdFH+qHs+ulGTk71ZlwFDwEunEzsfMpfSkahkKRCb5622etZ izJG9LwcDeW2qY6ZYrYS0FGCc8Nvt8MytY/d7s0CU+AZbRsYxSMTCjSEsZXEZrKM5U34 lLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=cl4sWmS8; 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 s21-20020a63af55000000b005639fa45a28si198832pgo.630.2023.07.22.05.33.36; Sat, 22 Jul 2023 05:33:49 -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=cl4sWmS8; 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 S230206AbjGVL4u (ORCPT + 99 others); Sat, 22 Jul 2023 07:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbjGVL4p (ORCPT ); Sat, 22 Jul 2023 07:56:45 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904B62D46; Sat, 22 Jul 2023 04:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026685; 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=vWjncXjiCmOApnwrSM4Cd6iO/mHi8UOW3/VBKdasyw8=; b=cl4sWmS8BYMFArLhDmUcTqi8Sj16qDJV26GhC9RFXSlqluch0tOSCP7gy7MJL4YffBm1Bd TxLeGDRoXqrqBlHIS0YZnsMaQYgYmaK2MirAw9NkUZrDw6IErA+gMwSAFsbeIvyu4S5QeL ca3EuDQnQbe/ZovRirKPTL6Uf4/XU1w= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jonathan Cameron , Peter Korsgaard , Andrew Lunn Subject: [PATCH v2 14/22] i2c: ocores: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:38 +0200 Message-Id: <20230722115046.27323-15-paul@crapouillou.net> In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net> References: <20230722115046.27323-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 Reviewed-by: Jonathan Cameron --- 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