Message ID | 20221023094852.8035-10-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1567197wrr; Sun, 23 Oct 2022 04:03:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oQ6H2wukF4/WKcoYHPKMbZu5kqtpJDn9UDTbuojxFq6LuGewXw/zdOaMzSrF+8fmzDUV6 X-Received: by 2002:a17:907:162a:b0:78e:2859:76be with SMTP id hb42-20020a170907162a00b0078e285976bemr22744860ejc.768.1666523029242; Sun, 23 Oct 2022 04:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666523029; cv=none; d=google.com; s=arc-20160816; b=KSLU6RGCDKE7UYmHUhwvlsW11bdBfs0XLCR75dqOA/Se0fzBqub6YsYjNwDR4DQhgf +aLO5v0voJn1x0Yhv+jQBbzz4Kqw53WoLGGmycRS/imjhMfsojD+k/FCBL6h9Upy393R 1piNyIZtaWZWO6eGHFXQmPZmthX6UxWq1lvB/1OyJoPO3RiDy0JZGG3kfPqqg3U6o7bm BOzr4fmJzybi/hx/QJmorn8nsvm2sGRJacL0TQzZRrXlQjRoyEyaNODTLmA+xSmtrEys cDgE3A2DlBV66QsqXdfaPRF5uPo2rwniCKqow2Xf55vi/4lavRFk7Z7O70YDNZ8M+e93 Y8Fg== 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=o88MccR3qEu1Ka3g1RWgK0rEm5DdYE6bq3HPlQGFNi4=; b=q+MtjNmyQaNT8zYFWRydwj6+Bc2tGAJ/g4F2Z4uFuTH//dWnfuUWOYcV5Zuc2/OzZP GYcysIwyQX5q/zXsUv1i94dyZOrBy+pQDsjSbJXAMZtq2JQHj6zdJ9x8ZqX3qAaLXnyO GbOOK2aZ1I8gD44+KRrTdaacgcwE+Pquiktj5epkJxtoI5KfVGoxkkB9rNpZ9wNSoK/x t/Czo6Y2OqLrpjQ5WKb5qXxZ1k4prB75UbefV1CHJoDlIIbZ6SaNNHE3aCxeZlflavpu kMU1G0gYoo/fveIvAlYShQd7WvXmDiBOCWeRHwUa0IFWQgNn18Uwd4kro5eMIOCrYlvq j9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=pcuJSH76; 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 sc11-20020a1709078a0b00b0078c9dd279b6si23547387ejc.345.2022.10.23.04.03.24; Sun, 23 Oct 2022 04:03:49 -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=pcuJSH76; 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 S230188AbiJWJvL (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiJWJu4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:50:56 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6838F5B7AD for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518548; 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=o88MccR3qEu1Ka3g1RWgK0rEm5DdYE6bq3HPlQGFNi4=; b=pcuJSH76iZA0NzImnhzEJW9EKq7oVQaT+snLzlGBC0H2whCUg2u8YgmO21xYq33N8W+IMH CddyIvSF3nqZAmX/czfADjkUGj59SSs6bgr9yHl4BqX+B/VEEiF4Ro35jkeR6Yh6vSWmKd /i15obtEisSF1mLVDw/ZgPzDH9fmgU0= From: Paul Cercueil <paul@crapouillou.net> To: Lee Jones <lee@kernel.org> Cc: linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net> Subject: [PATCH v3 09/28] mfd: ucb1x00: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:33 +0100 Message-Id: <20221023094852.8035-10-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747476051891879863?= X-GMAIL-MSGID: =?utf-8?q?1747476051891879863?= |
Series |
mfd: Remove #ifdef guards for PM functions
|
|
Commit Message
Paul Cercueil
Oct. 23, 2022, 9:48 a.m. UTC
Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.
These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.
This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/mfd/ucb1x00-core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index b690796d24d4..fc4d4c844a81 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -660,7 +660,6 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv) mutex_unlock(&ucb1x00_mutex); } -#ifdef CONFIG_PM_SLEEP static int ucb1x00_suspend(struct device *dev) { struct ucb1x00_plat_data *pdata = dev_get_platdata(dev); @@ -728,15 +727,15 @@ static int ucb1x00_resume(struct device *dev) mutex_unlock(&ucb1x00_mutex); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, ucb1x00_suspend, ucb1x00_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, + ucb1x00_suspend, ucb1x00_resume); static struct mcp_driver ucb1x00_driver = { .drv = { .name = "ucb1x00", .owner = THIS_MODULE, - .pm = &ucb1x00_pm_ops, + .pm = pm_sleep_ptr(&ucb1x00_pm_ops), }, .probe = ucb1x00_probe, .remove = ucb1x00_remove,