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);