Message ID | 20230722115046.27323-4-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp775153vqg; Sat, 22 Jul 2023 05:26:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlH6Z7+q3FAgxzxWhaoLn8a7OctpTI2iPE8tS72kpPN1Gms8shsVzRO8YrO10xIDqi8CDp0O X-Received: by 2002:a17:902:b114:b0:1b8:7483:d481 with SMTP id q20-20020a170902b11400b001b87483d481mr3799064plr.8.1690028815476; Sat, 22 Jul 2023 05:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690028815; cv=none; d=google.com; s=arc-20160816; b=ggXdFF8odjl69bbXFiKO4SfU1JhdidtmqHkfpC9sR7fP538ASTW19LgcLHLs7j5iFe byiuAL0Qf9nI94eSaLME5gdroRDZ/rDdTcaWU7nWrvTCRfulhIHG0b+HEmeRmpDM33hB 9GBPrCaQ058VLKZZn2tlvqUh6KvYgss2EbFBttqAzqn5iHOx7wT5/aqEpirb+6Ipy+3A O+EzNRqgP77hiPzjIUyNRfeyR0infuVGGapY6RdSc9WMunfVFXQfC7xpz8he0Ixh2K9T KWxPDPfw6/9LACXPAeDMLbGpPyKX9tnSabePuohumEmEcO8r7nd4awvdgSyxXCXaK1dX GguQ== 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=3KIt+a22Ffe/m+Ih0lyp0HmaKGBLRsOsK70rxD3459M=; fh=NTc4ACz07msXAbFl4v90zS5gRwf3v0GTKo+TWEvOuiE=; b=ItDSMvEJEg4ihZ+HCTKXUXPHggj5BzB/TpqonbWPf94SFmRdUlmu1D09dOtLJ3NdKo 2CMq736bLphGH+G2dtEzPE/GlwDFbCV21Ld4G3pO3M+l8lJauv9pFS9AhJEWh3Tcym2d wkmt4B8xJhHrphO44t4Qq01vZqO/6K9Spsx6QOTpYM3JnH2TR7cZEO8qJknF9lgYoLvz p3s5hk06a1lfaTFuQyX2B/t4cwNxWJeJ/rc4Inci2SbYSi5xPuyst5BJlDYXqtgHhQdn O+fYW/RYMyKOgH2EC7Q8KSq60lBN5cn0b8F3Aw5Gf46NSMjC/5UNjhF8KJHGH34QQxGx td/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=m4H4fG9R; 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 kv8-20020a17090328c800b001b8c8bcc811si4790071plb.165.2023.07.22.05.26.42; Sat, 22 Jul 2023 05:26:55 -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=m4H4fG9R; 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 S229836AbjGVLvw (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Sat, 22 Jul 2023 07:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229713AbjGVLvu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 22 Jul 2023 07:51:50 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7F53C23; Sat, 22 Jul 2023 04:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026663; 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=3KIt+a22Ffe/m+Ih0lyp0HmaKGBLRsOsK70rxD3459M=; b=m4H4fG9RL5/SCfWfqeBRF8QkrSRJkXlzqvQ/aPfIm7oNzx38s//YBsCnregYXEUbZ+tRB9 4a7gLfe+9rXbLwxT9oSnOzJDQpEUZHNpUZjRrJs1e7TDG14ElY8aL8yW1lwIVArx3V/ufL AHwEdUlong/255edBxgct+da+Uo9HH8= 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>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Kamal Dasu <kdasu.kdev@gmail.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Florian Fainelli <f.fainelli@gmail.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 03/22] i2c: brcmstb: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:27 +0200 Message-Id: <20230722115046.27323-4-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: Yes 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: INBOX X-GMAIL-THRID: 1772123655352505424 X-GMAIL-MSGID: 1772123655352505424 |
Series |
i2c: Use new PM macros
|
|
Commit Message
Paul Cercueil
July 22, 2023, 11:50 a.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> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- Cc: Kamal Dasu <kdasu.kdev@gmail.com> Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-brcmstb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Comments
On 7/22/2023 4:50 AM, Paul Cercueil 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> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c index cf92cbcb8c86..c778bcca95fe 100644 --- a/drivers/i2c/busses/i2c-brcmstb.c +++ b/drivers/i2c/busses/i2c-brcmstb.c @@ -697,7 +697,6 @@ static void brcmstb_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); } -#ifdef CONFIG_PM_SLEEP static int brcmstb_i2c_suspend(struct device *dev) { struct brcmstb_i2c_dev *i2c_dev = dev_get_drvdata(dev); @@ -715,10 +714,9 @@ static int brcmstb_i2c_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(brcmstb_i2c_pm, brcmstb_i2c_suspend, - brcmstb_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(brcmstb_i2c_pm, brcmstb_i2c_suspend, + brcmstb_i2c_resume); static const struct of_device_id brcmstb_i2c_of_match[] = { {.compatible = "brcm,brcmstb-i2c"}, @@ -732,7 +730,7 @@ static struct platform_driver brcmstb_i2c_driver = { .driver = { .name = "brcmstb-i2c", .of_match_table = brcmstb_i2c_of_match, - .pm = &brcmstb_i2c_pm, + .pm = pm_sleep_ptr(&brcmstb_i2c_pm), }, .probe = brcmstb_i2c_probe, .remove_new = brcmstb_i2c_remove,