Message ID | 20221023094852.8035-21-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 s2csp1555506wrr; Sun, 23 Oct 2022 03:20:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5v/7qIDJZSfekYdH1CcKak/9I6eLG4KT9k7L8Zyk4Ww6uliXPbcMNXy6N3yaAehaqrtWcd X-Received: by 2002:a17:907:75c1:b0:79b:f804:c081 with SMTP id jl1-20020a17090775c100b0079bf804c081mr9604271ejc.381.1666520424509; Sun, 23 Oct 2022 03:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520424; cv=none; d=google.com; s=arc-20160816; b=0e92kan+N2P5GooEjn5xVIo6YIyVCbGtYKXHCI9GtXnY1SzfzUVS/H3tIxv0+snqMP AqEuZBqCi2U7fCmts6EPBGLLQxXRS3fyVGBTamHYmj43M8MfYMuu07Dj/jWz/GdMIx36 Eh7ilTHb97OC90uql0V+xRDtE3UQSo7qbXHICXlpmQx7VHm5Unlt1T7ikRfOvFSWS03g SqvmdFpCJlefg9T99iH2vXxoBKsSVZMQgbFfXNCt06UBCEUW4P24+MM2wGVt6W2nfpJC de7v7yv0GSg66ReX1PGF1CM1B6yZlwOZI+rqicMA9zxKLHW78XhsnOb/iQ7FyUMEGIoi 3OJQ== 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=jS4RbK1fBZHnJZWsSL9bNObOtXdqrDwmB2EJvhOE5WE=; b=0/G1juR/Y7LymKVclLvAZ1tDrKs8Mv/FaroGUoH3JfyBn6CK+RzCS7bZN7DIK9Tt3b m6XO3vcMm5GyzyjflodeSHQHbBXgRlDTMqy0F6EH4sbR+bgKFBbYmrc0wqJlSVCy+nev kTfAu2rwmsL//md7NKCiojiruJeo1Q26M1cGz68CMlLp+F6O+hnZ4UKSlHOeaSmsEx0N 3/HgvKMlm32rUXTxRomXw5FySXIG2l6DyvNaKT3Uv9NjRpYiTwRmg8z/4+HBkcvVM45A bpaFi1LIR99946NLYtTFjZZemKt60twZQbQea3hi6wewZYRRGc1lpbWox2RWZNLEQ/SR T5Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=rtXmaloH; 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 q5-20020a1709064c8500b0078200f886bbsi24729503eju.361.2022.10.23.03.19.59; Sun, 23 Oct 2022 03:20:24 -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=rtXmaloH; 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 S230242AbiJWJxr (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJWJxm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:53:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D4A2760E9 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518555; 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=jS4RbK1fBZHnJZWsSL9bNObOtXdqrDwmB2EJvhOE5WE=; b=rtXmaloHsvGNzT2AB4fOw0XJ32A/93glRX494xsmj5xI3pald7gB9yu0TSeTydLWcu0Fgq 3L2+usa7H/VMv8RTwemGLTPJuYmdRPtiY67VWAndb6WY26Upa8rcVpp5sBtv0IBHMt9mkx Acd0H9jxZPGpkS8moPeJq3/bwvwBUG8= From: Paul Cercueil <paul@crapouillou.net> To: Lee Jones <lee@kernel.org> Cc: linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH v3 20/28] mfd: max14577: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:44 +0100 Message-Id: <20221023094852.8035-21-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?1747473320928477132?= X-GMAIL-MSGID: =?utf-8?q?1747473320928477132?= |
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> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- drivers/mfd/max14577.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index 6c487fa14e9c..9de29a8070c7 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c @@ -482,7 +482,6 @@ static const struct i2c_device_id max14577_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); -#ifdef CONFIG_PM_SLEEP static int max14577_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -515,14 +514,13 @@ static int max14577_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); static struct i2c_driver max14577_i2c_driver = { .driver = { .name = "max14577", - .pm = &max14577_pm, + .pm = pm_sleep_ptr(&max14577_pm), .of_match_table = max14577_dt_match, }, .probe = max14577_i2c_probe,