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 65E9CC19F2A for ; Sun, 7 Aug 2022 14:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235169AbiHGO5m (ORCPT ); Sun, 7 Aug 2022 10:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbiHGO5D (ORCPT ); Sun, 7 Aug 2022 10:57:03 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46C16B857 for ; Sun, 7 Aug 2022 07:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883989; 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=0c3a2/qF6KMNUu4+OEl7LBzPeW/O+IuR41ANjZXV6gA=; b=gEVfKW6UDfL26RCFk1Cf2TaBbBC/3e8QGdDpLsY8V6/ys5hhYbGuOUpmSPGvsPii3UgSxu dO+9KxfL1jQDYLxN+eGf9i2nHzjY3l6/PGZlInHtIJf5M21vWCgjIM/21JTv+e2N/yu5Ws 1dykgSE0gXVA4tncq32qyQ/YJovN5g0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 27/28] mfd: tc3589x: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:46 +0200 Message-Id: <20220807145247.46107-28-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 --- drivers/mfd/tc3589x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 13583cdb93b6..ab7e0f6f5489 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -438,7 +438,6 @@ static int tc3589x_remove(struct i2c_client *client) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int tc3589x_suspend(struct device *dev) { struct tc3589x *tc3589x =3D dev_get_drvdata(dev); @@ -466,9 +465,9 @@ static int tc3589x_resume(struct device *dev) =20 return ret; } -#endif =20 -static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resu= me); +static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, + tc3589x_suspend, tc3589x_resume); =20 static const struct i2c_device_id tc3589x_id[] =3D { { "tc35890", TC3589X_TC35890 }, @@ -485,7 +484,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id); static struct i2c_driver tc3589x_driver =3D { .driver =3D { .name =3D "tc3589x", - .pm =3D &tc3589x_dev_pm_ops, + .pm =3D pm_sleep_ptr(&tc3589x_dev_pm_ops), .of_match_table =3D of_match_ptr(tc3589x_match), }, .probe =3D tc3589x_probe, --=20 2.35.1