Message ID | 20230705204314.89800-16-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2139179vqx; Wed, 5 Jul 2023 14:11:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlF0J3Ml9Yfa7rW22IfHyxcE9f7aEhUE97jbDByclSq/O6V5BDxaD4315UvoZn5EX32if7n7 X-Received: by 2002:a05:6870:73cd:b0:1a3:5de8:e78b with SMTP id a13-20020a05687073cd00b001a35de8e78bmr242349oan.21.1688591491910; Wed, 05 Jul 2023 14:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688591491; cv=none; d=google.com; s=arc-20160816; b=CVBKMKNxGzF79TPcmB1KTVe9FWxZIqTPrXy0Rdkw15A6PDHu/9mwRvwav6rzZbPHk3 WoBnPjWcQ0mSh1N7vvvUzttoCTE06VjniESeTzxQjS5TxlNSmwrnqbYYLtIYC1WjLB3t D/dMerQS6Jv0e68vDT0mIHz7INz3+rvVNmMUvlytCfbRZ6Iid75Gb54iMIY1yrq92gq/ ZjVorMDJbPRmRzJ1rUFSU3iyfHZiKz7U1rXr6mphUU8Fe1rlpSos/rCrYk611IHE+SaD ccVmGscbyfTQrbhxZLNSfYMV7c6gDbCXs0K1VVqJyM/9yZ72xEMh0ikMGsgDFgOWS8PA kDIw== 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=13zXeW5CGUD650EYX/aZt7qIyciVOz912RMPQMwE/QQ=; b=Zeir4cE7iWVDtvE3FJNlVDg78wk7KXofUfrKzGYWfy5P9MVJ6p4UfbE84Xw7w1P2lN fZRwGY4GHCaPORAquiNM0Z7Fm7PqxtiFkh6/eKaQDz875X8INcZql5GzjQI4BFdyIbh8 Nu/OrTuqhYUayj2GAm6ICPnromIEC1vhfRSFzYutzdFQIvIFCW1FN03/HUBawMh2Xfjw P5dz4f5cZEyElik8Q0vjT8Dwcj7Vr/Ufp3UxOOYCS6rWsFkK6kcxz3Rpn7tmrzVvJndk OrWQrYB+BGF3cYaE6/nkBiQ7MpEuhbap/9krXNlSj7SkeqMVmmTJuE3dHAe6r+Ghv2zI VyGA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a17090aca0f00b0025c238650d1si71011pjt.174.2023.07.05.14.11.17; Wed, 05 Jul 2023 14:11:31 -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 S233895AbjGEUrc (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <paul@crapouillou.net> To: Wolfram Sang <wsa@kernel.org> Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Peter Korsgaard <peter@korsgaard.com>, Andrew Lunn <andrew@lunn.ch> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770616511901126297?= X-GMAIL-MSGID: =?utf-8?q?1770616511901126297?= |
Series |
i2c: Use new PM macros
|
|
Commit Message
Paul Cercueil
July 5, 2023, 8:43 p.m. UTC
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 <paul@crapouillou.net>
---
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Andrew Lunn <andrew@lunn.ch>
---
drivers/i2c/busses/i2c-ocores.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
Comments
On Wed, 5 Jul 2023 22:43:06 +0200 Paul Cercueil <paul@crapouillou.net> wrote: > 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 <paul@crapouillou.net> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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), }, };