From nobody Sat Apr 11 21:30:05 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 167F9C19F2A for ; Sun, 7 Aug 2022 14:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234841AbiHGOzv (ORCPT ); Sun, 7 Aug 2022 10:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbiHGOzX (ORCPT ); Sun, 7 Aug 2022 10:55:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1246175 for ; Sun, 7 Aug 2022 07:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; 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=ILGkOjBbxQ6/oFH45I21cYP8YppPBAHJarOOSD0Anzg=; b=Ji1TNYdO9uNnL434iMBgQ4dfjBePw83p7ofilPXqQDHIk2QLiuxO7nc4TE6PwAXFV2Byv9 XghPAVeetYDznix7FhwviD9hrKvbSIFo7mAgqISjj+xl6YGzsVf/H8VF33MYRo9dlC0CWr asywwHCFzR8/Bq9QtsuuqmP9e2It1fc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , patches@opensource.cirrus.com Subject: [PATCH 17/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:36 +0200 Message-Id: <20220807145247.46107-18-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-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. The advantage is then that these functions are now always compiled independently of any Kconfig option, and thanks to that bugs and regressions are 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 Cc: patches@opensource.cirrus.com --- 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