Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30172249rwd; Thu, 6 Jul 2023 01:50:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGstW8PEoVzJfeTrBPR+iwMdLwz+/mBQDoLauYLcd8qW9pD85fR7q8yeZko5wEW1L65AU7+ X-Received: by 2002:a05:6358:98a9:b0:132:dc58:b372 with SMTP id q41-20020a05635898a900b00132dc58b372mr240920rwa.19.1688633442402; Thu, 06 Jul 2023 01:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688633442; cv=none; d=google.com; s=arc-20160816; b=d7lOdvEG0Rm1TDt+L3inHWVXH558Wp22yJEfSxp4jen0qXLmny/waksZL8k8lobkz/ LgtxhQOjRBR032dyf1mBIjhniOnCrDhkmYyKIIHPm0a/jU6jwG8c8d9f1GQezpY88grx psDM5/upAvduAWPdHsurt3qCUiopA0fNN2bqwOk/6sPBMwhuTDu1hELfZ8P9d59khALk NT1z0LCcJFrzXCoUPvXcuvgvmXv9n9yI7wh/xZkFWnz5RAqZfisxrnwDrIM4LV9etlsL 2iE5LMh/uliBgDzjzwSUpw0/acn/lVb73wsP/w1hNma6ol9evL2EDIw3L36cmBmKMBDb xf8Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=C5ZsjOqtPPGYJFIxPY4zElOVIK+rkHUv8ea5aIS7+R8=; fh=7s3laOj/RtmfEjG5StkWXEy0nrr7IxegdHSCZ7G2tJI=; b=j0nXkmaWLohF0zVbWVSP/Y36GchDn95Kb1Pbjof6nkrVS1oTgOQs1RTkXH8VlcZoYj ooSPH5i7hK3h/mKZEMK0D/M7rMzHmz47yJwWCYh13Z3ZAZQUektxVx4ZivgFIVPomCqu w/sI8+G3l7BxW4rUrh5Y0lX9/uA74phgAvYoF51V405tUm6PZoX2vzsc/HheQP6laVmJ l+OyrGFc9fX348jD1KPN/Paw9RcH9IEiUHFmVuucC/2toK1zSxx9CvAxnfubn6Jxiv34 XCQg8L9S3cEK7klyXIxo790Whi7G0orJ96IV6+JMQrWfgfJQdNDSGIN7AyWZeg1Hx9vk loqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=JKl+j3vK; 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 b30-20020a630c1e000000b0053424040bb7si1042108pgl.298.2023.07.06.01.50.29; Thu, 06 Jul 2023 01:50: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=JKl+j3vK; 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 S229945AbjGFI3k (ORCPT + 99 others); Thu, 6 Jul 2023 04:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjGFI3j (ORCPT ); Thu, 6 Jul 2023 04:29:39 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A048172B; Thu, 6 Jul 2023 01:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688632175; 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; bh=C5ZsjOqtPPGYJFIxPY4zElOVIK+rkHUv8ea5aIS7+R8=; b=JKl+j3vKNg/eW7Ik2efJYb5lOny2bzPXKHYPEG/5xYgAXHtv83U9yljp/qy68vtp6glsPD LVa0jH4/k1CT7YM1O+k6sDFMKGmZvfPnRi75TvMXhvl69gaOf0mfM2dB+mh0W/ef6iWTZ1 M0HsxfUVhFSsydQbE6AMQnTVF4T7aFo= From: Paul Cercueil To: Xingyu Wu , Samin Guo , Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH] watchdog: starfive: Remove #ifdef guards for PM related functions Date: Thu, 6 Jul 2023 10:29:28 +0200 Message-Id: <20230706082928.10869-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 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 --- 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, }, }; -- 2.40.1