From nobody Sat Apr 11 21:30:08 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 50186C19F2A for ; Sun, 7 Aug 2022 14:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234305AbiHGOxZ (ORCPT ); Sun, 7 Aug 2022 10:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234291AbiHGOxW (ORCPT ); Sun, 7 Aug 2022 10:53:22 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E60FA195 for ; Sun, 7 Aug 2022 07:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883981; 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=jeDp4mkUztMMW1RvCNc9votvIoNVltLlfIbqBqy6Kj4=; b=RBAPFh9HvvXfNJe6C6hZdpNhVlhe3iAP4MZ+Pi3Q+gDHUQeapWyQGsC2Dmc4qiPMHNkRgN 3LrjKiKk/usE2szw15tYNV+qY4+3hdtNDQAvQxPCHuD/KrEjBmlTKtnGMzNGNps4crJOj7 Nb+DZXJmWR+xVjG61nBYkhl2IuY+OBg= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:21 +0200 Message-Id: <20220807145247.46107-3-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/aat2870-core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index a17cf759739d..8a3967c3f026 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -409,7 +409,6 @@ static int aat2870_i2c_probe(struct i2c_client *client, return ret; } =20 -#ifdef CONFIG_PM_SLEEP static int aat2870_i2c_suspend(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); @@ -438,10 +437,9 @@ static int aat2870_i2c_resume(struct device *dev) =20 return 0; } -#endif /* CONFIG_PM_SLEEP */ =20 -static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, - aat2870_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, + aat2870_i2c_resume); =20 static const struct i2c_device_id aat2870_i2c_id_table[] =3D { { "aat2870", 0 }, @@ -451,7 +449,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[= ] =3D { static struct i2c_driver aat2870_i2c_driver =3D { .driver =3D { .name =3D "aat2870", - .pm =3D &aat2870_pm_ops, + .pm =3D pm_sleep_ptr(&aat2870_pm_ops), .suppress_bind_attrs =3D true, }, .probe =3D aat2870_i2c_probe, --=20 2.35.1