From patchwork Tue Apr 26 07:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Xinpeng X-Patchwork-Id: 566446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52D42C433FE for ; Tue, 26 Apr 2022 07:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343634AbiDZHGp (ORCPT ); Tue, 26 Apr 2022 03:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343625AbiDZHGm (ORCPT ); Tue, 26 Apr 2022 03:06:42 -0400 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 88A9C6D4C2; Tue, 26 Apr 2022 00:03:35 -0700 (PDT) HMM_SOURCE_IP: 172.18.0.48:51254.2065698957 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-202.80.192.38 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id B42EE2800BC; Tue, 26 Apr 2022 15:03:32 +0800 (CST) X-189-SAVE-TO-SEND: +liuxp11@chinatelecom.cn Received: from ([172.18.0.48]) by app0024 with ESMTP id 08721fdb41b643019545bdfc34306865 for wim@linux-watchdog.org; Tue, 26 Apr 2022 15:03:34 CST X-Transaction-ID: 08721fdb41b643019545bdfc34306865 X-Real-From: liuxp11@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 Sender: liuxp11@chinatelecom.cn From: Liu Xinpeng To: wim@linux-watchdog.org, linux@roeck-us.net, tzungbi@kernel.org Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Liu Xinpeng Subject: [PATCH v4 4/4] watchdog: iTCO_wdg: Make code more clearly with macro definition Date: Tue, 26 Apr 2022 15:03:08 +0800 Message-Id: <1650956588-795-5-git-send-email-liuxp11@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1650956588-795-1-git-send-email-liuxp11@chinatelecom.cn> References: <1650956588-795-1-git-send-email-liuxp11@chinatelecom.cn> Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Using SET_NOIRQ_SYSTEM_SLEEP_PM_OPS reduces redundant code. Signed-off-by: Liu Xinpeng Reviewed-by: Tzung-Bi Shih --- drivers/watchdog/iTCO_wdt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 3f2f4343644f..8d24cf4f4ca3 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c @@ -635,22 +635,18 @@ static int iTCO_wdt_resume_noirq(struct device *dev) return 0; } +#endif /* CONFIG_PM_SLEEP */ static const struct dev_pm_ops iTCO_wdt_pm = { - .suspend_noirq = iTCO_wdt_suspend_noirq, - .resume_noirq = iTCO_wdt_resume_noirq, + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_noirq, + iTCO_wdt_resume_noirq) }; -#define ITCO_WDT_PM_OPS (&iTCO_wdt_pm) -#else -#define ITCO_WDT_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ - static struct platform_driver iTCO_wdt_driver = { .probe = iTCO_wdt_probe, .driver = { .name = DRV_NAME, - .pm = ITCO_WDT_PM_OPS, + .pm = &iTCO_wdt_pm, }, };