From patchwork Thu Oct 20 18:50:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp278644wrr; Thu, 20 Oct 2022 12:09:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zp9pIK9fTzeuWMn5RcSjga+vD9lMfxdn6NIqg0qP10W+pqmqr/1cMZdyxCqzvLJRl0BJ9 X-Received: by 2002:aa7:d415:0:b0:459:4c7:60ce with SMTP id z21-20020aa7d415000000b0045904c760cemr13637570edq.202.1666292971896; Thu, 20 Oct 2022 12:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666292971; cv=none; d=google.com; s=arc-20160816; b=oXc46ATGeEtoSAG5G7Vng/zyI3Tvpz2g5NSk9+CZEfQPzVvshylYCtFOj3+QgM1uuI Fay2070sUvvEoLxWmzpIJI8anrNIT87BKFIZgDHG5CxqMkViAIrTXzQw0lyXvlbbc0aG rRG0V/Ms6qy/UxMPU2DLLqHc9bptdKpd7LW5PCYMM/6RQCMN/TtVWs2eXczBq2Jt0vbc R6uTY/VmuOOkz0fvqPHeCAbjFdW3SZg+kOY0HMCSgBIW/8+nw5E5bLBxu5IS8oHLcM7o hKihM6m5UoTz0Psp4ZTYfLUvm4noMUdYPsRcu2aNyuL8n6rmlRSWGS8IuxUZ/eOmDukq fu/Q== 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=T5IpqpesPwT77Jvi5jmQo30Q/fMNFWN8hFsyxEzy+wU=; b=jh2WwQbL7HduL10OeOfEXkeBRFAYQZDqFpZ8x9dUJ+WWrGIi7SpHr9CB0aMLYC4zG/ ThIGnmhoemc/KYTMYgfnc/ewDkNhI9qkutJLSVnD/OdEDXsarPm9Tiks3/G2+9jcbsP+ 2fY1sCEdKH94t4cjXaj0QHY11GG/nN2zRNhgGbUQq/d94/+wNRZQW3yt00bUBiG/i1FU rKLBX0GJ+BBvjLdFzczqWYMTCbrfIJfx8KkU6A8KXgrUIAuYdZ1GGjHTbUpwHLo/tzI+ HQ641xIXekg1v8HpuymWWLH9Co8byqum84cR1fm89IHd2HI3rLuz/eKuR6Yu8OSgkawH 2l3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=RV8v8Mco; 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 n7-20020a509347000000b0045440929f87si3087323eda.86.2022.10.20.12.09.06; Thu, 20 Oct 2022 12:09: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=RV8v8Mco; 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 S230126AbiJTSvL (ORCPT + 99 others); Thu, 20 Oct 2022 14:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbiJTSvH (ORCPT ); Thu, 20 Oct 2022 14:51:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABECD156256; Thu, 20 Oct 2022 11:51:02 -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=T5IpqpesPwT77Jvi5jmQo30Q/fMNFWN8hFsyxEzy+wU=; b=RV8v8McoZWApg9qmSCRUuGTBvS8MtaVJr25IDyp3vXfG0El7CofrN8G8SqO6nLop+B3omY s6oXK5yHJQ1KWBSqpRZh5GmagNBCB8kV9r8TayjZWGG5bmdTIRZ1In7RZO/f3Rey9HIZGT gnUN08FlnCXn3fWoJIz30relP/B7l7M= From: Paul Cercueil To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] watchdog: at91rm9200: Remove #ifdef guards for PM related functions Date: Thu, 20 Oct 2022 19:50:44 +0100 Message-Id: <20221020185047.1001522-2-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: 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, 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?1747234818976924867?= X-GMAIL-MSGID: =?utf-8?q?1747234818976924867?= 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 Reviewed-by: Claudiu Beznea --- Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Claudiu Beznea Cc: linux-arm-kernel@lists.infradead.org drivers/watchdog/at91rm9200_wdt.c | 11 ++--------- drivers/watchdog/db8500_wdt.c | 9 ++------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index 6d751eb8191d..5126454bb861 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c @@ -278,8 +278,6 @@ static void at91wdt_shutdown(struct platform_device *pdev) at91_wdt_stop(); } -#ifdef CONFIG_PM - static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message) { at91_wdt_stop(); @@ -293,11 +291,6 @@ static int at91wdt_resume(struct platform_device *pdev) return 0; } -#else -#define at91wdt_suspend NULL -#define at91wdt_resume NULL -#endif - static const struct of_device_id at91_wdt_dt_ids[] = { { .compatible = "atmel,at91rm9200-wdt" }, { /* sentinel */ } @@ -308,8 +301,8 @@ static struct platform_driver at91wdt_driver = { .probe = at91wdt_probe, .remove = at91wdt_remove, .shutdown = at91wdt_shutdown, - .suspend = at91wdt_suspend, - .resume = at91wdt_resume, + .suspend = pm_ptr(at91wdt_suspend), + .resume = pm_ptr(at91wdt_resume), .driver = { .name = "atmel_st_watchdog", .of_match_table = at91_wdt_dt_ids, diff --git a/drivers/watchdog/db8500_wdt.c b/drivers/watchdog/db8500_wdt.c index 6ed8b63d310d..97148ac0aa54 100644 --- a/drivers/watchdog/db8500_wdt.c +++ b/drivers/watchdog/db8500_wdt.c @@ -105,7 +105,6 @@ static int db8500_wdt_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM static int db8500_wdt_suspend(struct platform_device *pdev, pm_message_t state) { @@ -130,15 +129,11 @@ static int db8500_wdt_resume(struct platform_device *pdev) } return 0; } -#else -#define db8500_wdt_suspend NULL -#define db8500_wdt_resume NULL -#endif static struct platform_driver db8500_wdt_driver = { .probe = db8500_wdt_probe, - .suspend = db8500_wdt_suspend, - .resume = db8500_wdt_resume, + .suspend = pm_ptr(db8500_wdt_suspend), + .resume = pm_ptr(db8500_wdt_resume), .driver = { .name = "db8500_wdt", }, 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, From patchwork Thu Oct 20 18:50:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp278856wrr; Thu, 20 Oct 2022 12:09:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4I87uR7Uud89/0iZOfnvAYI77kUWYxxP+RRlATZUdJ1CAX+F+N6sjGryxBjuvOjXbikNm4 X-Received: by 2002:aa7:cc8a:0:b0:45b:f851:2943 with SMTP id p10-20020aa7cc8a000000b0045bf8512943mr13828078edt.103.1666292996644; Thu, 20 Oct 2022 12:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666292996; cv=none; d=google.com; s=arc-20160816; b=VKFguoQSNgNvqxQbQj04Q0CP7GOq6rBog0V0+ogMQfin2akq0VxXC22eilP1iiRbB+ IDlQs4i5xSN3hUOp57WpBMkhBnvVxIe7g/cWmKgtrbjh6R3wh1vCIA/j2Y9SJW+GzHnF qR8AyvxXWDBFcoSZA0oouxmHRQcglh9L1etD3ar7pWVUU4zbwGqnNBz2GgGKwpv/kZ2M 4LkvqbzYEX6VqYHtB6wZOVh8Iw/vY8Gy/Gg5Ky5MnlqT1oA8bPK8K0Uvx4V94IL65q+2 z/vlkwB3Hk5yKEJZatzA6DxDq8PmE1rML1sXWqPYxhDlWcJYM7UTuXsUXDGxva31bTyy aGyg== 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=31qI4IyMllYZtSn4jgOmFJFt3IC2yVgWJx1sJSLJGZE=; b=xEFd+ReSmmOPwC/HBiPDVe/F33OUuRts8rCmdGhgNuVjcESSMMI2NxsPbaY8wy3wBl PNIfII/3Fw8kO+Yu+AVSGJIIYw0UfEMmGjpaYWrOJfFxSxsSomU7IZCbZh8qVAQAtqPx OglIHD8uX/DNkXHL+aF1jK+K/DUhc2fw0SvyvvgwSOmz8YMRmhxU3MFptvfUgxE0bplN OLQze3yyEeF1U2emjhYI/KjfLi3igCu9uJYx0BjJ1MaOiINRz4jbizRrjYFZkpLQ/+5I KYVGWgCo2IJwcz1HaZtGyjotmorVI3cnWnkE5STSgnoV0NUWWbsp0DShwQVfKZsRkAEB Jqgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=jS2b28qw; 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 k19-20020aa7c053000000b004573f60f27csi15922682edo.440.2022.10.20.12.09.31; Thu, 20 Oct 2022 12:09:56 -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=jS2b28qw; 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 S230138AbiJTSvZ (ORCPT + 99 others); Thu, 20 Oct 2022 14:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbiJTSvW (ORCPT ); Thu, 20 Oct 2022 14:51:22 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8F0170B59; Thu, 20 Oct 2022 11:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666291855; 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=31qI4IyMllYZtSn4jgOmFJFt3IC2yVgWJx1sJSLJGZE=; b=jS2b28qwE28HJaF1yBs2kv2L1YlMNT1ryDO6CdMegxqzvI7pKzi2RZmXl0aFoGI3KKG6lA M1OzHcPZ+s2D9F6ybRn/GubVEflE2Wc70jFqM/IkhJ26gx5cF3ryDcXtvzvPumBlp4seJB D9ncjWaLUSE0eLtrYQa4Wr3OGAgKK7s= From: Paul Cercueil To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 3/4] watchdog: omap: Remove #ifdef guards for PM related functions Date: Thu, 20 Oct 2022 19:50:46 +0100 Message-Id: <20221020185047.1001522-4-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?1747234845706392369?= X-GMAIL-MSGID: =?utf-8?q?1747234845706392369?= 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 Acked-by: Aaro Koskinen Reviewed-by: Guenter Roeck --- drivers/watchdog/omap_wdt.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 74d785b2b478..e75aa86f63cb 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -316,8 +316,6 @@ static int omap_wdt_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM - /* REVISIT ... not clear this is the best way to handle system suspend; and * it's very inappropriate for selective device suspend (e.g. suspending this * through sysfs rather than by stopping the watchdog daemon). Also, this @@ -353,11 +351,6 @@ static int omap_wdt_resume(struct platform_device *pdev) return 0; } -#else -#define omap_wdt_suspend NULL -#define omap_wdt_resume NULL -#endif - static const struct of_device_id omap_wdt_of_match[] = { { .compatible = "ti,omap3-wdt", }, {}, @@ -368,8 +361,8 @@ static struct platform_driver omap_wdt_driver = { .probe = omap_wdt_probe, .remove = omap_wdt_remove, .shutdown = omap_wdt_shutdown, - .suspend = omap_wdt_suspend, - .resume = omap_wdt_resume, + .suspend = pm_ptr(omap_wdt_suspend), + .resume = pm_ptr(omap_wdt_resume), .driver = { .name = "omap_wdt", .of_match_table = omap_wdt_of_match, From patchwork Thu Oct 20 18:50:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp279100wrr; Thu, 20 Oct 2022 12:10:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6touB0Ls51FAJVkoPpsVka04IcoNaEQjfTk6w2BV2l0mhhjxXS+7HC/GkLYtqOMj9z35Gd X-Received: by 2002:a17:907:7f93:b0:791:91a6:5615 with SMTP id qk19-20020a1709077f9300b0079191a65615mr12719577ejc.708.1666293033454; Thu, 20 Oct 2022 12:10:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666293033; cv=none; d=google.com; s=arc-20160816; b=ScTzCvQQtCVEjhosCX8QwHPrpUQfw5QadI9dCi+kVHBU9IHkb0C7ej7I/McJGYVFf+ JHf2KEvb/ieJJ/7CTv7Yz+WWmU2tWEmx7DPcsmQOIdltDMIWwB9bPv9+J3Gs6yjTuV4/ kbstKb4R8pKLtaC9TtruorsfEikkk1DCpEV76CZhGOJ13MAuQ3ksW+2pvhGE/K8bQ+vJ K1q5/XbDIxNh3BYr3wd9FHRKgB6PKqJhZaLNWntuB/2dX+ekaox9nMLqcSkmxRZ/uYy7 oBs1Mg5hSsjpk6PoxiaaYpDp3/N2CO5lrCtxYFosPvVfW4Wh9XwSqMP8Us9xhs9jCyiz VTGw== 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=mQZXeiJoM7b+oCY4wSe+cuIVpnUFu+3jGMCQghIgiAE=; b=vEosNAQ4DjIP4AYRksTUmFuCa/JcmGww95Q3bYm7OTZ/0vn15jPndPToZ95nK9S58t J0oyrQD8BZYYZSXnpMPPt7rKwLZcTqashZ/Rjoe1FLkmT5vuGmQfKsEos4/FI7als40E 9zsL0RSTBjVu7R0iJHmU2ioePWtVa2DNrDYfP6NuXsO1OPnvEEMoKA1NySy2RgKndlMd eMmCVtcL/iFsaf3qNTtOt8mor5zhLTAI5dUsW4nxhYarPonkosFbfXgwwFhShuFiT2gp QRLCUS/hpKYtX2gPGNh5pbaUwZjsNnuZdTtuU5V+vHTYwrw0h5YqjUMXZyzvKP2aDmP5 utvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=KSZlzIwZ; 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 m17-20020a056402511100b0045938ab7129si19244573edd.330.2022.10.20.12.10.08; Thu, 20 Oct 2022 12:10:33 -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=KSZlzIwZ; 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 S229746AbiJTSvi (ORCPT + 99 others); Thu, 20 Oct 2022 14:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbiJTSve (ORCPT ); Thu, 20 Oct 2022 14:51:34 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70B6156256; Thu, 20 Oct 2022 11:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666291856; 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=mQZXeiJoM7b+oCY4wSe+cuIVpnUFu+3jGMCQghIgiAE=; b=KSZlzIwZ7zv1BtHDprWFJCCjVtX4LG3si1Q25EIAcmMdewXUHIeQr8V34Pk0vndAl3QbKZ sQLsF8O/cDlz6G5XYNv0t4kVmyJuowLOOHpRguseqO/vJY+nbcXW+xRq3S4W58bfCpGGCs E2/FZlre0GIYViQn5b6BNTPxLPLCnzg= From: Paul Cercueil To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 4/4] watchdog: kempld: Remove #ifdef guards for PM related functions Date: Thu, 20 Oct 2022 19:50:47 +0100 Message-Id: <20221020185047.1001522-5-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?1747234883786031463?= X-GMAIL-MSGID: =?utf-8?q?1747234883786031463?= 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/kempld_wdt.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index 40bd518ed873..e6c7a2906680 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c @@ -75,9 +75,7 @@ struct kempld_wdt_data { struct watchdog_device wdd; unsigned int pretimeout; struct kempld_wdt_stage stage[KEMPLD_WDT_MAX_STAGES]; -#ifdef CONFIG_PM u8 pm_status_store; -#endif }; #define DEFAULT_TIMEOUT 30 /* seconds */ @@ -495,7 +493,6 @@ static int kempld_wdt_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM /* Disable watchdog if it is active during suspend */ static int kempld_wdt_suspend(struct platform_device *pdev, pm_message_t message) @@ -531,18 +528,14 @@ static int kempld_wdt_resume(struct platform_device *pdev) else return kempld_wdt_stop(wdd); } -#else -#define kempld_wdt_suspend NULL -#define kempld_wdt_resume NULL -#endif static struct platform_driver kempld_wdt_driver = { .driver = { .name = "kempld-wdt", }, .probe = kempld_wdt_probe, - .suspend = kempld_wdt_suspend, - .resume = kempld_wdt_resume, + .suspend = pm_ptr(kempld_wdt_suspend), + .resume = pm_ptr(kempld_wdt_resume), }; module_platform_driver(kempld_wdt_driver);