Message ID | 20221023094852.8035-22-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 s2csp1563419wrr; Sun, 23 Oct 2022 03:49:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VVGY3pGqij8Hvy1nEwuhPepu6ltcgNgSkfGK4xyFRPz/F2vE5VN2vU+U1SNvr6QNcHr0j X-Received: by 2002:a17:907:270d:b0:7a5:f25d:9efe with SMTP id w13-20020a170907270d00b007a5f25d9efemr1687368ejk.640.1666522187621; Sun, 23 Oct 2022 03:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522187; cv=none; d=google.com; s=arc-20160816; b=OZopI+Bh77eDeFps4r+KWwjnVE7O6SDjKktCNkB1OVIxlQbnM1m7cd0INU3b4pAIDj WL13VXhyzDGk8KmHopz0q/eN7Zh+EG0X2xV6VrkV7+4Ru3pytwA6+XE53Zc3mNhaizXx ZOWT1KiLGW1U+LPUN1J+9MUt6CbCAzbbVE2wMMZ9K+w+REqW15FyMjHTxPBURVcfTjIu Vw/Mp7TxIP+paB05PGSQRFMM0Jd8QDORPcJIXZ1+PMTH0X252n+H0hhYfQNoe8Wv2qlW resWTUTSP1ZoxMl/y+vcSnOuVALU87hBTQM9guwbY3e6g3oZCx0Ea/au0Yn4jwIK3YcW LvXA== 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=aDdXMBaOyK7oXLIUXU8KO8h1827AMeVClKPmuTxxjYw=; b=VCmZ2IabuujA1/rtBgakmpJKzHQLrwBoAOprhwqyQrrfk1zVLL52lp74LfCYOlNz2S 00YblMpIsa1rfYMt8yJDY6pRcukyyaKOIWW9TgM5k6A0SfkleyOC31uyaebRqlhEEVjD npFwUIzbKYUfdGo9D9Bn37mQ8A5hRLsliLjww2/CB1vVDEppS5pr5kyq9hn1KHW1fhua KmjA0ebkbymW71ZZtbVgSxQEyAS0SZuMeRvrYjNkmZW5HLN1/SWsT3vg3k4b6Wpss4cc CI594r7ei1rNjzpgK7rw8uYnzPC2tKQXY1OIJ28zBQsZrRYXzKTHbOZzEnuNOqf0+L6H bAqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=UVcgkd2h; 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 m22-20020aa7c2d6000000b0044e9fd71b82si21357440edp.280.2022.10.23.03.49.23; Sun, 23 Oct 2022 03:49:47 -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=UVcgkd2h; 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 S230251AbiJWJyA (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJxw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:53:52 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE32857227 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:53:49 -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=aDdXMBaOyK7oXLIUXU8KO8h1827AMeVClKPmuTxxjYw=; b=UVcgkd2hqBcVTDUblKW3Y+9nk5/fMeVVyGZYIWvhDzaCIWOkUxmwBQdyN3JQupoMFszBVp yI+asK4EPSJltpmZ7zS7Caj/JDgmv3A6Eva7yNng/Ed+fBnDg482KqaaeuLKQ0ThFT1T3h b6DQA5qDSaJPv3K1ERHiG5kKTzsyI1g= 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 21/28] mfd: max77686: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:45 +0100 Message-Id: <20221023094852.8035-22-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?1747475169362908671?= X-GMAIL-MSGID: =?utf-8?q?1747475169362908671?= |
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/max77686.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 2ac64277fb84..f8e863f3fc95 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -226,7 +226,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c) return 0; } -#ifdef CONFIG_PM_SLEEP static int max77686_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -261,14 +260,13 @@ static int max77686_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); static struct i2c_driver max77686_i2c_driver = { .driver = { .name = "max77686", - .pm = &max77686_pm, + .pm = pm_sleep_ptr(&max77686_pm), .of_match_table = max77686_pmic_dt_match, }, .probe_new = max77686_i2c_probe,