Message ID | 20221023094852.8035-27-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 s2csp1564142wrr; Sun, 23 Oct 2022 03:53:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mcib7PeIpmKqVlG8XKjgRwI/1q7gY0tK4tFGPng6CaAkSNTnlhLJiZ/5SCuxpX5v+GeEg X-Received: by 2002:a63:e544:0:b0:462:2c80:f521 with SMTP id z4-20020a63e544000000b004622c80f521mr22612183pgj.549.1666522385203; Sun, 23 Oct 2022 03:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522385; cv=none; d=google.com; s=arc-20160816; b=B23YiQ0/IPdrmEDK+nieObho5ZfblBYhNkPhHjZqBI6vIF2qEvq/qzf9pRRteArwVC imfo1iZ7S3JBOv4GGdnNPMptd0VBCj6ooOEfr1kb3bcyQ+UEBFeguBD4E+XNb56sZNhx 7CNUtkozYHFCzLdwi0DYHfkpntNBP3aMGxSO9MkRobGOlMF/giUSf82f2OoNdZvwHnwD 2TM1iod/eqFVOAItkiJ2PULstIYt0AUIsSKEWlsJ4myocM0kv+XNoP5DyTnjGqkYj30v e7TUcIEojGLDMXa4X1sOEkIIu0FKrK6Usk8ZOZ8btuv3rCvUJbNFR8THIXKNvyXDcqr0 DiQg== 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=/fNX/ttuDiI3uxQdqB3fB+Ou1WPOijArfObsH7/WKDQ=; b=H7ZPCDpLlcqIwpKihEDc4SUlTJup2B+rKS9HTJVA13NG3ItbYGtCl4q8LCjHkECeyj /ZKJv+TyFWX6TZ/bAHgqCYP2gOTU+1Mv4d7391o8HT4oDGk3Idf6H8H/wXAg8vYZrzQj KwPc8aA1zeOXAC8zy/tEYh65mkBiDkPRxHT4C4/lGoHlMATmMuRNA/52pwGE8o6/ixJn 29F4BBnPeNhR5Wu5col8uB48EZudyDt/IQS6/MiKN3jCmKMdbxSq4hl0GjxucOKWbZJS e+DGuU/TwAOWGoLFK8IAZv3Mgio2Rk/3xK5FsIAYXKQU/rEbAJm1Uh6UM/JnEGLOhi8s yVmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=wCCE0tHv; 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 u8-20020a654c08000000b0043c64130f17si31717494pgq.107.2022.10.23.03.52.51; Sun, 23 Oct 2022 03:53:05 -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=wCCE0tHv; 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 S230327AbiJWJzS (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJzC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:55:02 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1491A64C7 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518559; 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=/fNX/ttuDiI3uxQdqB3fB+Ou1WPOijArfObsH7/WKDQ=; b=wCCE0tHv8/OT2rcRBgCsOIsb3437XkIhFuiBPr9YpJrNSDMXXA6oO9VyoWbMBqyvqJWa+e hnE2TDg7GEmZw8xjJ4JmnZt19h7hj/VfXzqA4PIXll3DGb92Z3rdV+HNVACGJEQ6Vx3r5+ exZQ3XfFRab1Lt3oJtvaZMq8QTICq68= 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 26/28] mfd: tc3589x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:50 +0100 Message-Id: <20221023094852.8035-27-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?1747475376610955281?= X-GMAIL-MSGID: =?utf-8?q?1747475376610955281?= |
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/tc3589x.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 13583cdb93b6..ab7e0f6f5489 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -438,7 +438,6 @@ static int tc3589x_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int tc3589x_suspend(struct device *dev) { struct tc3589x *tc3589x = dev_get_drvdata(dev); @@ -466,9 +465,9 @@ static int tc3589x_resume(struct device *dev) return ret; } -#endif -static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, + tc3589x_suspend, tc3589x_resume); static const struct i2c_device_id tc3589x_id[] = { { "tc35890", TC3589X_TC35890 }, @@ -485,7 +484,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id); static struct i2c_driver tc3589x_driver = { .driver = { .name = "tc3589x", - .pm = &tc3589x_dev_pm_ops, + .pm = pm_sleep_ptr(&tc3589x_dev_pm_ops), .of_match_table = of_match_ptr(tc3589x_match), }, .probe = tc3589x_probe,