From patchwork Sun Oct 23 09:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1554978wrr; Sun, 23 Oct 2022 03:18:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ctq2Nd7ssNGWorw3FkbI6WESzMphMpBjWmr9Jqq5yfCqWrF9FUWZjnSXOyiw+AJh9uhOg X-Received: by 2002:a05:6402:5107:b0:45d:409:1337 with SMTP id m7-20020a056402510700b0045d04091337mr26466834edd.185.1666520300631; Sun, 23 Oct 2022 03:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520300; cv=none; d=google.com; s=arc-20160816; b=fODDLzql8jC/JqRKtpehCDMmXHAalPvT+FqL/6+XKWyjowAr8q7Fj+/hXd7ZACe3En 55zgyKiP3UZJnvJ6sD5T0iyRqoEXJ+QRBh3/NPsMd+xKwBEK++iZRLMPHp/rEJRds24u uviuFzVFaV39+LyYm8t2CwwfPF3rqzGJ3CnK4Sem5igPp7TEru/buJoWhMVB2beNMEFE g/hRz65pYh7iGouElCGbM/sE6PIsMskyU+5+lxky3gwxj+i1TBwyH9yK+o00A5lp5WuS B/M04aoWKikcpR+inQfu2uD+C1g6f/P0C2k/kiFdhm1ZBxiOFRgyVlmjLHSEggPpaflK hjaQ== 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=hjKKqw3Bk3xbTfdsBUYQKJyI4PHiU8JemC2E70n/LOg=; b=UKdyPAlhIbjOFFoRixq8IVr5tJxJjJO3GGCJtl67a7q/wykoQStu8t1aAio1ACnKiA uovCOOXDn7kXCYxV2wEbQnYMukeZT5TWeB6mP61rQvYpmndNsnCugAhOQrZoHDbvTTCr /VsfTQok5sNaOgl1RdSjlqMRLCOABTQUzmrqJhvGWjxqNyvZrPyWMsLy7E5kDUKSP2Dv AmvzbbzOPwu6wmr1FFA6hxCYRcguIz9C4/2QNYvV2s6+H443Ma74lnTbWKMUdeDqpVoe 0PYLsuxDse6MuZQmB+FeCm7V1QyAdo4zXyt0n2NJ8LOH4LoEh2OQrRb2a7cer49vyG5W FjEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=0usJwLGZ; 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 ga13-20020a1709070c0d00b0078d2197d670si24080742ejc.661.2022.10.23.03.17.56; Sun, 23 Oct 2022 03:18:20 -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=0usJwLGZ; 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 S230204AbiJWJxc (ORCPT + 99 others); Sun, 23 Oct 2022 05:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJx3 (ORCPT ); Sun, 23 Oct 2022 05:53:29 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29CD75CC2 for ; Sun, 23 Oct 2022 02:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518554; 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=hjKKqw3Bk3xbTfdsBUYQKJyI4PHiU8JemC2E70n/LOg=; b=0usJwLGZjJ+e/1Vb9BwWtfQuGR6MEwx+OK98wvscHh0B4ccXJYqJZ/svmM2+nwVOsZcK14 3HElOeLjAwv76sNkobr6+Pv2HjvnkDnOFBfra0DiDMsuGDuAnOe7cS8VwXXWGbJ77spbUR vJ6LBe/UdZBd6ijdOt0LvoNw+pmSzoo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 19/28] mfd: arizona: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:43 +0100 Message-Id: <20221023094852.8035-20-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?1747473190872983864?= X-GMAIL-MSGID: =?utf-8?q?1747473190872983864?= Only export the arizona_pm_ops if CONFIG_PM is set, but leave the suspend/resume functions (and related code) outside #ifdef guards. If CONFIG_PM is not set, the arizona_pm_ops will be defined as "static __maybe_unused", and the structure plus all the callbacks will be automatically dropped by the compiler. 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 Acked-by: Charles Keepax --- V2: Use new EXPORT_GPL_DEV_PM_OPS() macro V3: No change drivers/mfd/arizona-core.c | 19 +++++++------------ drivers/mfd/arizona-i2c.c | 2 +- drivers/mfd/arizona-spi.c | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index cbf1dd90b70d..bd7ee3260d53 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -480,7 +480,6 @@ static int wm5102_clear_write_sequencer(struct arizona *arizona) return 0; } -#ifdef CONFIG_PM static int arizona_isolate_dcvdd(struct arizona *arizona) { int ret; @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static int arizona_suspend(struct device *dev) { struct arizona *arizona = dev_get_drvdata(dev); @@ -784,17 +781,15 @@ static int arizona_resume(struct device *dev) return 0; } -#endif -const struct dev_pm_ops arizona_pm_ops = { - SET_RUNTIME_PM_OPS(arizona_runtime_suspend, - arizona_runtime_resume, - NULL) - SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, - arizona_resume_noirq) +EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) = { + RUNTIME_PM_OPS(arizona_runtime_suspend, + arizona_runtime_resume, + NULL) + SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, + arizona_resume_noirq) }; -EXPORT_SYMBOL_GPL(arizona_pm_ops); #ifdef CONFIG_OF static int arizona_of_get_core_pdata(struct arizona *arizona) diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 6d83e6b9a692..8799d9183bee 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c @@ -119,7 +119,7 @@ static const struct of_device_id arizona_i2c_of_match[] = { static struct i2c_driver arizona_i2c_driver = { .driver = { .name = "arizona", - .pm = &arizona_pm_ops, + .pm = pm_ptr(&arizona_pm_ops), .of_match_table = of_match_ptr(arizona_i2c_of_match), }, .probe = arizona_i2c_probe, diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 941b0267d09d..da05b966d48c 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c @@ -282,7 +282,7 @@ static const struct of_device_id arizona_spi_of_match[] = { static struct spi_driver arizona_spi_driver = { .driver = { .name = "arizona", - .pm = &arizona_pm_ops, + .pm = pm_ptr(&arizona_pm_ops), .of_match_table = of_match_ptr(arizona_spi_of_match), .acpi_match_table = ACPI_PTR(arizona_acpi_match), },