From patchwork Thu Oct 20 18:50:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp279869wrr; Thu, 20 Oct 2022 12:11:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Lyifjw0sI7N6JwgPcpP+H//Infk6KtA6+X31LHTSxnTPnUgfR6pzo+SBgIWMPHYrUsoji X-Received: by 2002:a17:906:846e:b0:78d:ed3c:edfa with SMTP id hx14-20020a170906846e00b0078ded3cedfamr12213469ejc.515.1666293118456; Thu, 20 Oct 2022 12:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666293118; cv=none; d=google.com; s=arc-20160816; b=OK+WSSTorXLll+5V+6i7jUfTvDuw2XtlzJTjCVWYMJiBzQUAmW571Ub4CVsBcfx5cl YtiC7lg8bVQA3HWC+/FvnfWbT9fHtqIecOq+d0qOHzBhYcd4hEKSyENQpiUhApmGvSA5 XzsP1dOsYfq538n9IGJDC3yrs8YTCchPTatye9bMMJmhBbOmD1RzHTRzXkaIESOzS/N/ IMaN7CcA34Kr1usSsnZWp3hJYJu4inU+DcxaJLOVUNM27uvpIRwBVkk0jgYtv5gLC+CR dhcloMsZ5xQXHMrn7n1Wo+KZ/RuiADtNv0G8o9y/EWy35cq+qfFQEAhy3G50hD3e4Mpw sFIw== 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=xIYc2tjT8/lB6pDNaHqi80nRJ3Rpz+QWPGYXDoEgJJA=; b=YAFpBG3uLhdabFZjRyT9KQ4cgyrx7W2x2BpDZ60RhNeuHkInOxQE6XWXZdVR79rfK2 RaolM+VljI472qBa8N7FI23xlYY1lllD3Us3lksiMXKdViqs1e/M34Zn3oIcJ6tyrcNn OzFjvs1HqpicLasQjvRIb00xi1y3CwVjwSQvO74PREo8ABOZn6AWFJAT2aS1lqwAl/FD JjhSOOOuGeOp58tSFMuvcp8yvqQfaI07pe3WPG6QZJJ+L6BKMDtlYet4z7vhpCN0Z/Jz IoyDVTDwX8ddYcscHerSuwmmSPiO++0h3ciZvgOBDlHzfO0sVR69nGzgeGXVSrgN3sS+ ky1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=GirfJmHs; 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 i10-20020a1709064fca00b0078db1258ae9si20970367ejw.555.2022.10.20.12.11.33; Thu, 20 Oct 2022 12:11:58 -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=GirfJmHs; 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 S230164AbiJTSvW (ORCPT + 99 others); Thu, 20 Oct 2022 14:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbiJTSvO (ORCPT ); Thu, 20 Oct 2022 14:51:14 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44974170B7B; Thu, 20 Oct 2022 11:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666291854; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xIYc2tjT8/lB6pDNaHqi80nRJ3Rpz+QWPGYXDoEgJJA=; b=GirfJmHsDYS5A0zJTzVT68o6M9UJTsIM/0b4c/YXdzZF2Ub6z1pUsVZVerJ65Dg2SskBht D0h4up67DGzMSNpCTTXKtnmtFfUVjLf+7C3dsx2eJuwMqPJ6DXllIHlCnVuIYrTFhTF/8g XIUeX7e4fQdOiD2nKrOH80uxlk4Dhho= From: Paul Cercueil To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 2/4] watchdog: twl4030: Remove #ifdef guards for PM related functions Date: Thu, 20 Oct 2022 19:50:45 +0100 Message-Id: <20221020185047.1001522-3-paul@crapouillou.net> In-Reply-To: <20221020185047.1001522-1-paul@crapouillou.net> References: <20221020185047.1001522-1-paul@crapouillou.net> MIME-Version: 1.0 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, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747234972919218138?= X-GMAIL-MSGID: =?utf-8?q?1747234972919218138?= Use the pm_ptr() macro to handle the .suspend/.resume callbacks. This macro allows the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Guenter Roeck --- drivers/watchdog/twl4030_wdt.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c index 36b4a660928d..09d17e20f4a7 100644 --- a/drivers/watchdog/twl4030_wdt.c +++ b/drivers/watchdog/twl4030_wdt.c @@ -81,7 +81,6 @@ static int twl4030_wdt_probe(struct platform_device *pdev) return devm_watchdog_register_device(dev, wdt); } -#ifdef CONFIG_PM static int twl4030_wdt_suspend(struct platform_device *pdev, pm_message_t state) { struct watchdog_device *wdt = platform_get_drvdata(pdev); @@ -99,10 +98,6 @@ static int twl4030_wdt_resume(struct platform_device *pdev) return 0; } -#else -#define twl4030_wdt_suspend NULL -#define twl4030_wdt_resume NULL -#endif static const struct of_device_id twl_wdt_of_match[] = { { .compatible = "ti,twl4030-wdt", }, @@ -112,8 +107,8 @@ MODULE_DEVICE_TABLE(of, twl_wdt_of_match); static struct platform_driver twl4030_wdt_driver = { .probe = twl4030_wdt_probe, - .suspend = twl4030_wdt_suspend, - .resume = twl4030_wdt_resume, + .suspend = pm_ptr(twl4030_wdt_suspend), + .resume = pm_ptr(twl4030_wdt_resume), .driver = { .name = "twl4030_wdt", .of_match_table = twl_wdt_of_match,