From nobody Wed Apr 8 06:41:35 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71950C433FE for ; Sun, 23 Oct 2022 09:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbiJWJwl (ORCPT ); Sun, 23 Oct 2022 05:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbiJWJwj (ORCPT ); Sun, 23 Oct 2022 05:52:39 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A0F74DC2 for ; Sun, 23 Oct 2022 02:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518552; 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=lyyljsq433FjzziKmqqvZZTp5vtZQm0VWBzs9lEg4/Q=; b=Bl3qJQwnF/mgh0ZIe2ANQ9s2QygwMAyVqFAKAH0Qht5gnhf9aTanNjSzHHMn0rTOqhV4RQ iMUF7iMh7BYx9Xvd3IDhGphIsclQNcgAIRf3PUoufiwJo9pv7MB2dwJhb8f+IoJ2Pgo0ki 1ofViD+ouPLOUHCv3x7cD6ehVvbTJrU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 16/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:40 +0100 Message-Id: <20221023094852.8035-17-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the .runtime_suspend/.runtime_resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM 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. Note that this driver should probably use the new DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide .suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and pm_runtime_force_resume() respectively; unless those callbacks really aren't needed. Signed-off-by: Paul Cercueil Acked-by: Charles Keepax --- drivers/mfd/wm8994-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 7b1d270722ba..a27a13b5ae1e 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -110,7 +110,6 @@ static const char *wm8958_main_supplies[] =3D { "SPKVDD2", }; =20 -#ifdef CONFIG_PM static int wm8994_suspend(struct device *dev) { struct wm8994 *wm8994 =3D dev_get_drvdata(dev); @@ -213,7 +212,6 @@ static int wm8994_resume(struct device *dev) =20 return ret; } -#endif =20 #ifdef CONFIG_REGULATOR static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) @@ -676,13 +674,13 @@ static const struct i2c_device_id wm8994_i2c_id[] =3D= { MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); =20 static const struct dev_pm_ops wm8994_pm_ops =3D { - SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) + RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) }; =20 static struct i2c_driver wm8994_i2c_driver =3D { .driver =3D { .name =3D "wm8994", - .pm =3D &wm8994_pm_ops, + .pm =3D pm_ptr(&wm8994_pm_ops), .of_match_table =3D wm8994_of_match, }, .probe =3D wm8994_i2c_probe, --=20 2.35.1