Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31591380rwd; Fri, 7 Jul 2023 01:21:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlG3bQqaLPW7PuG2kbHRNEaFkrbL1cbC9h0Hss9jukVFa78KaBkYnz2FuT2GUPp6XG+0jWuC X-Received: by 2002:a05:6870:b525:b0:1b0:89fb:9e77 with SMTP id v37-20020a056870b52500b001b089fb9e77mr4906586oap.35.1688718070679; Fri, 07 Jul 2023 01:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688718070; cv=none; d=google.com; s=arc-20160816; b=NdJ6fSfEXKKAkIrcR8rjnXsXftD3YPEiD4qB6bmUWHeZK6G+jRBu3CZi4LH87rXxWE 2ycsc1pei8PiqedbJJBet3jnL73E5w+5gVaUrKZkqHsoPjyU6mgIPJu7OBM2t5NseR5y Vt3Q7u0JJVo60eZMi4E+F9PATHIm+IvU8OnCu1Wh9HUsxomyhHvKDqTKW11mydGLP9IV HGVGTE0/VaZRb3wgzv3pbOkieat53ueFR6u+eAYtjp9vrW5LDv5cF9mnGmNR+QH02tR8 G09TLbWgGPrOM4UBVJKyj41LjUfHeTzi3IPEtRfamRYwt1dCnK/MAzzx0hbCPl5vjOzp Nhhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=d1pFIdEZI2DSewZ7fuP2fQu9cXB76mwROAoii4t/X84=; fh=EJKiAQxTewaWX+lVryAaTLwvW65JugECYLHrlwUuQog=; b=h//0xku9ILLugjLLMlwrd8hHeAD9HmUbzKl+aFrTvTLNQaLQW+okjWpPxybYeOZvSA 87kGdaWGCKKCv+f2lakTkaINChlElO6MrfL3B+WwjmkyeGcpCCawuOSdNMc6I0jjN61j thkHBeBBDMYE9uPt4NxduupEbUGyibzzlqIQ8jvdAxYWj15xOsLsHPc+eRWYeKQC0h0n VkHQLCkniE8qy1Me5jgRg1WOIdBQN15y/wAyFJYlc22cphxhd3mqMmQuuhqY+R9bW1MD p8liQ2qA8sKg01NfTj3atFpfmnOAFcf6riLoxzRWAD1EC8vu+ghu+GzsfMyyxCkQdET1 ilYA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u63-20020a638542000000b005538961c4ebsi3397010pgd.715.2023.07.07.01.20.59; Fri, 07 Jul 2023 01:21:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232394AbjGGHiG (ORCPT + 99 others); Fri, 7 Jul 2023 03:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjGGHiF (ORCPT ); Fri, 7 Jul 2023 03:38:05 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E7619B2; Fri, 7 Jul 2023 00:38:02 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 5EDF124E1AC; Fri, 7 Jul 2023 15:37:48 +0800 (CST) Received: from EXMBX061.cuchost.com (172.16.6.61) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 7 Jul 2023 15:37:48 +0800 Received: from [192.168.125.128] (113.72.145.114) by EXMBX061.cuchost.com (172.16.6.61) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 7 Jul 2023 15:37:47 +0800 Message-ID: Date: Fri, 7 Jul 2023 15:34:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] watchdog: starfive: Remove #ifdef guards for PM related functions Content-Language: en-US To: Paul Cercueil CC: Samin Guo , Wim Van Sebroeck , Guenter Roeck , , References: <20230706082928.10869-1-paul@crapouillou.net> From: Xingyu Wu In-Reply-To: <20230706082928.10869-1-paul@crapouillou.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [113.72.145.114] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX061.cuchost.com (172.16.6.61) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2023/7/6 16:29, 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 > --- > drivers/watchdog/starfive-wdt.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c > index 8058fca4d05d..7c8a1c5e75be 100644 > --- a/drivers/watchdog/starfive-wdt.c > +++ b/drivers/watchdog/starfive-wdt.c > @@ -526,7 +526,6 @@ static void starfive_wdt_shutdown(struct platform_device *pdev) > starfive_wdt_pm_stop(&wdt->wdd); > } > > -#ifdef CONFIG_PM_SLEEP > static int starfive_wdt_suspend(struct device *dev) > { > struct starfive_wdt *wdt = dev_get_drvdata(dev); > @@ -556,9 +555,7 @@ static int starfive_wdt_resume(struct device *dev) > > return starfive_wdt_start(wdt); > } > -#endif /* CONFIG_PM_SLEEP */ > > -#ifdef CONFIG_PM > static int starfive_wdt_runtime_suspend(struct device *dev) > { > struct starfive_wdt *wdt = dev_get_drvdata(dev); > @@ -574,11 +571,10 @@ static int starfive_wdt_runtime_resume(struct device *dev) > > return starfive_wdt_enable_clock(wdt); > } > -#endif /* CONFIG_PM */ > > static const struct dev_pm_ops starfive_wdt_pm_ops = { > - SET_RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL) > - SET_SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume) > + RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL) > + SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume) > }; > > static const struct of_device_id starfive_wdt_match[] = { > @@ -594,7 +590,7 @@ static struct platform_driver starfive_wdt_driver = { > .shutdown = starfive_wdt_shutdown, > .driver = { > .name = "starfive-wdt", > - .pm = &starfive_wdt_pm_ops, > + .pm = pm_ptr(&starfive_wdt_pm_ops), > .of_match_table = starfive_wdt_match, > }, > }; Great, Thank you for the improvements. Best regards, Xingyu Wu