Message ID | 20221023094852.8035-4-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 s2csp1553104wrr; Sun, 23 Oct 2022 03:13:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aSAQCBr+DnRg4sskt2Bg4ZcCAYJX3VHsOjuMZa7xrXTOes1LRr3Pe+K0bhKd7ZSdRdvVk X-Received: by 2002:a17:906:4fc3:b0:72e:eab4:d9d7 with SMTP id i3-20020a1709064fc300b0072eeab4d9d7mr22895572ejw.599.1666519988367; Sun, 23 Oct 2022 03:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666519988; cv=none; d=google.com; s=arc-20160816; b=W1Ef95GbjtVFjBeDq6rLw+XIaBytUDiXbMlapoQ4D+i/gfVqNOjQKzeOeqnxN5N6TY cySf+wMBRw5GheHlgMDR2BuXZc0tsunB7iQ07DMsNvSt1hD0AgNkKuShJwKuZ+vXMyzE yClHhghYKwhtnary27egFmKbs3uJkuM4R4hDAHPf0iXHV2kh74vFPEGaq/D/iF2HszHm 4sJqBY25xmLs8cmOeuAPQn/LsU9bgdiuKmhSzuv4nQ8OqJQQVggXgEQXSg8wuq+Ms0hL WetvObPHOMcXTjhbRqd5yTtA+QwQ+MGTK2yskxrOfTNnhIMFP2YZPhJWNq55MOz2e9Ye qr7Q== 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=RmH+YiYpUPBPp3yS1R7ESWCNgocdrFNtdRwVFv9A680=; b=PrQip3WulrQbrbQ0DVvFQ1RyPDOCea70WZGHXyd8PEpA95ghk41+cq6GRC5/NWO4MV z5h/KXIw6eduyuezWSPt0NuIdspcJ4IYG+1gApU6tztFXjCQxdERkv6/EaTmhYfJvIo9 qzlEq68j1shh9CSrAsfbPkDyxs3A5o3naZv3b7xPOZDxT82MV7EtH9yb5T/XZ72X9w29 OWmD8MFnTPgZ2UvHftJarWq6Nd3rof3OsgzIpwTLf5zQJUUKSxOzay02U7fT1Iv8Wt/f Q2KRsEXzMwf4NKl+HhASfhzBSg6JT7I0Mb9oT9Likvp4BJ9EJ0QniPykYZWswh8ZPEEx yLrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=fCp4riuw; 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 p3-20020a17090635c300b0078d4b2754b5si21807565ejb.332.2022.10.23.03.12.39; Sun, 23 Oct 2022 03:13:08 -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=fCp4riuw; 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 S230171AbiJWJtl (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiJWJti (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:49:38 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA37DED9 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518544; 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=RmH+YiYpUPBPp3yS1R7ESWCNgocdrFNtdRwVFv9A680=; b=fCp4riuws/yV0z90McsIaD8AOSmeDlATXdIEtcZlsGuNd7LS8J/sE8HogShUDfwX+GxsYD YvVLzqNw9q9+ARe/rGF/Q9nmjK1LEOGYjI4I7gVIY+M945OucjK+6snNsVkJC2t2JDUeeo UXZjVazw7lJmUMe5PWM8eZlo5msa0I4= From: Paul Cercueil <paul@crapouillou.net> To: Lee Jones <lee@kernel.org> Cc: linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Michael Hennerich <michael.hennerich@analog.com> Subject: [PATCH v3 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:27 +0100 Message-Id: <20221023094852.8035-4-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?1747472863680031691?= X-GMAIL-MSGID: =?utf-8?q?1747472863680031691?= |
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> Acked-by: Michael Hennerich <michael.hennerich@analog.com> --- drivers/mfd/adp5520.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index 8db15f5a7179..882eddc32f8e 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c @@ -305,7 +305,6 @@ static int adp5520_probe(struct i2c_client *client, return ret; } -#ifdef CONFIG_PM_SLEEP static int adp5520_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -326,9 +325,8 @@ static int adp5520_resume(struct device *dev) adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); static const struct i2c_device_id adp5520_id[] = { { "pmic-adp5520", ID_ADP5520 }, @@ -339,7 +337,7 @@ static const struct i2c_device_id adp5520_id[] = { static struct i2c_driver adp5520_driver = { .driver = { .name = "adp5520", - .pm = &adp5520_pm, + .pm = pm_sleep_ptr(&adp5520_pm), .suppress_bind_attrs = true, }, .probe = adp5520_probe,