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,