From nobody Sat Apr 11 21:30:02 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 397DAC19F2A for ; Sun, 7 Aug 2022 14:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235266AbiHGO5Q (ORCPT ); Sun, 7 Aug 2022 10:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234752AbiHGO4n (ORCPT ); Sun, 7 Aug 2022 10:56:43 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29ABC269 for ; Sun, 7 Aug 2022 07:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883988; 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=Di4PoDiPjRu7ZS4lHptDC2et/AkSYRZJ8WxHWXVd9fk=; b=M8PDLV+k4PAPs6D79cw8p2rh6Vx4VD2ELyDUhaqSKSWca15BHcIDzzjQ1MaYgg+XEYXWrV iWiVNeRH5E/4zQpjYAJHry4nbXXrkSxuxSKyTLBuDFe6gfzNRjhYRFAgHcIsgOevtlvSX2 hVwdvb9hWNozN9FFcBs+xLCexp2B12g= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:44 +0200 Message-Id: <20220807145247.46107-26-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 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. 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. Signed-off-by: Paul Cercueil Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Reported-by: kernel test robot --- drivers/mfd/stmfx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index 122f96094410..94af27346669 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -476,7 +476,6 @@ static int stmfx_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int stmfx_suspend(struct device *dev) { struct stmfx *stmfx =3D dev_get_drvdata(dev); @@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_res= ume); =20 static const struct of_device_id stmfx_of_match[] =3D { { .compatible =3D "st,stmfx-0300", }, @@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver =3D { .driver =3D { .name =3D "stmfx-core", .of_match_table =3D stmfx_of_match, - .pm =3D &stmfx_dev_pm_ops, + .pm =3D pm_sleep_ptr(&stmfx_dev_pm_ops), }, .probe =3D stmfx_probe, .remove =3D stmfx_remove, --=20 2.35.1