From patchwork Sun Oct 23 09:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1546838wrr; Sun, 23 Oct 2022 02:52:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qVdEwEA4JPcEDnt1vhs1UqfiMiS/YEFfXQ//+aCmeQeenMrCUIT//lqKF5YjUkk98E0LR X-Received: by 2002:a05:6a00:330a:b0:563:176d:af81 with SMTP id cq10-20020a056a00330a00b00563176daf81mr28374665pfb.13.1666518727491; Sun, 23 Oct 2022 02:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518727; cv=none; d=google.com; s=arc-20160816; b=IoDJcfpwz+iTEWoTRNRZ2ghCv4KgI3PGLrkH9y+t6H/eFJd1r/Cgax27sxFG4YafJ0 dlhemb7mTD6k9F3Q1nvrXv/2QXayWdaalPYCIWecXdkeSBN+NHNwdLpMM556sR9EnBV1 8H2vvIsNys8+iI1q4qf63MPY6zmKf0OLKcUhdSgFk5v0DoqxIte0PpiX61DPU2PoClA4 I/kz6WsILnYljrhNqGQDWSCoTAh06P6uypV8qrQC0cBpw+lKuP99ZuL1SgQKBhE7CpNv blr5v+m2BQyNGWquxWP9Oxp21T6NQjnVOIuJi04fQ9v3xgM9HSf1aM8FcUtlcFos5FFG I/zg== 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=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=v8IV+8Xkyw58Wml+zulBQw3nIvbOlVwRIenxkrXJDvpjE5wTJ17iK5FYh9qwB049aZ B2THDIACN7ffGPoI1ewEJUz2TV8Gn2s6Hm9qn9j8Rnptct12B+a/Q9Y2Dn0BsoBp4f4g J+krBp5CbTbcnIGqx6Akcl0bledFGyJvm0MRtqzA0PGYpiJwUaggOQZtB4R6g7kyoJbu AN9gOTed2pbbACMHSSNoZd5jdA+/SN7Eg5g8+f/K4eXjimt4Eacw/5bjcI6p3SUgNlSp qL0E8Eu+lXHy9T57oThlaWZ3/tETkX6zQ/Hx9CbmYkKpTAOFKigTNKkfXQ/yC/gyhNrF NLAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=kgb2K0N3; 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 l190-20020a6391c7000000b0046b127a88d5si29727753pge.552.2022.10.23.02.51.54; Sun, 23 Oct 2022 02:52:07 -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=kgb2K0N3; 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 S230146AbiJWJtO (ORCPT + 99 others); Sun, 23 Oct 2022 05:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbiJWJtM (ORCPT ); Sun, 23 Oct 2022 05:49:12 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A686BCEE for ; Sun, 23 Oct 2022 02:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518543; 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=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=kgb2K0N3EQq0luk0lhhXzMYrHyme9zzOFDWu8wKPFBkuqSry3SqyL4AWNrB6xM4PJipOup W7VMdgy9C95YrZ3A2iF07l0yi13+V8bPgVW4uhAIZCCt0ulYqqiZeiHEnRvS3mKmGSfVeX R2XF3LuDwrlh8XMbKOjQluhhNRCDo5w= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 01/28] mfd: 88pm80x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:25 +0100 Message-Id: <20221023094852.8035-2-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471540896584467?= X-GMAIL-MSGID: =?utf-8?q?1747471540896584467?= Use the new EXPORT_GPL_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 --- drivers/mfd/88pm800.c | 2 +- drivers/mfd/88pm805.c | 2 +- drivers/mfd/88pm80x.c | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index eaf9845633b4..409f0996ae1d 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -599,7 +599,7 @@ static int pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm800_probe, .remove = pm800_remove, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index ada6c513302b..724ac4947e6f 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -254,7 +254,7 @@ static int pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm805_probe, .remove = pm805_remove, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index be036e7e787b..ac4f08565f29 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -129,7 +129,6 @@ int pm80x_deinit(void) } EXPORT_SYMBOL_GPL(pm80x_deinit); -#ifdef CONFIG_PM_SLEEP static int pm80x_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev) return 0; } -#endif -SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); -EXPORT_SYMBOL_GPL(pm80x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); MODULE_AUTHOR("Qiao Zhou ");