Message ID | 20221023094852.8035-13-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 s2csp1547213wrr; Sun, 23 Oct 2022 02:54:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FpVAyPuaY32u3GG0ozHh7V5ZAT6KuIqlz30hLHI3pdEqyzOqBXbLnDPos59OpKSD2/klW X-Received: by 2002:a05:6402:34cd:b0:45d:a345:764 with SMTP id w13-20020a05640234cd00b0045da3450764mr25818705edc.415.1666518853609; Sun, 23 Oct 2022 02:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518853; cv=none; d=google.com; s=arc-20160816; b=ab6ICDwY+0HNRkHcGRCPZsdD6eGKaCQAJam9iAt6EDjKK7QAjVK0Oq0MY4V6A7j731 IoaI8OhfVGQux9j3uZJNFY2sHYAjsgeRAOWemdWN3YdhoovFtRvE3G9LqN78uoKr/EGP d9KalCfz7SJk9eq3yDx4+bU2NE17MZUrVU1cc0F3itplI88P3A/6Fw5t/gxI3oy2+rmL JquNahFgpX9rwVB9Z3bFMeTLpKv4/0hbh/DKzOty+kk6k43Ef0iOhLJZAYbBSWBpteKt zBdRmGvxKfDfAxKUBKthn7Xyxk0fYKQwTR3dQfgF2VJjvnSzYCqXzVmKynPTllgm56vf 9+5A== 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=PcfiZpIziLwA4ODr10aXNC1rF+NYGqY0uv8N27EWE4c=; b=QwOCa8BdJ9ebTShPEKG2sozPvWb9r55zXhqlO/wGCm8Y9mRIDy4DStIFDIx9CRdYF5 pace+LqpUZOe4E3alN8Azhzg8BTk8h68VYeGKY5GWcIqr0nUNKjvfQzVmFTPuV3URoQW EUl9KQkYPeShkKhkoFVT0SN9c05fVRyUPgQ6pXlZ97KOr7ynwz5cmhCVOQpDLMi0soCP /82OIt5UYI58Tlyugiq3KvnSo9ZfH0yz4jNEnGkHMTG9mX/SQf82vIcwdzCI5AYysHaS UxxEolt1c8u/+NX3NYF7mRaFoczozVadKAtXXRRha9QWNVteZOixjC0TTb8DEl9NsZm3 nwZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=YhTvZVmH; 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 cs12-20020a0564020c4c00b004618343b140si3439303edb.199.2022.10.23.02.53.49; Sun, 23 Oct 2022 02:54:13 -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=YhTvZVmH; 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 S230241AbiJWJvh (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbiJWJvQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:51:16 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F3B61D78 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518550; 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=PcfiZpIziLwA4ODr10aXNC1rF+NYGqY0uv8N27EWE4c=; b=YhTvZVmHDDsGDnwPpkTYrQVyMJ85ouFIUx8bvNDhK1W0Z3J6cXqelICtDze3JJLHIwhCus 5LBsz9nWnLdoLPzBuXsakv6NaqyS2hbN6aQp6HayJws1Y5OL9i63m9UWqGAQ9n/2f16+PW 4HHMWZyjiV860Ke+MlvR/rTrMBW3J9k= 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 12/28] mfd: sec: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:36 +0100 Message-Id: <20221023094852.8035-13-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?1747471673243219466?= X-GMAIL-MSGID: =?utf-8?q?1747471673243219466?= |
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/sec-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 1fb29c45f5cf..a467de2b2fea 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -455,7 +455,6 @@ static void sec_pmic_shutdown(struct i2c_client *i2c) regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); } -#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -488,14 +487,14 @@ static int sec_pmic_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, + sec_pmic_suspend, sec_pmic_resume); static struct i2c_driver sec_pmic_driver = { .driver = { .name = "sec_pmic", - .pm = &sec_pmic_pm_ops, + .pm = pm_sleep_ptr(&sec_pmic_pm_ops), .of_match_table = sec_dt_match, }, .probe = sec_pmic_probe,