From nobody Tue Dec 2 01:24:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C1AD182D0; Mon, 24 Nov 2025 00:39:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763944744; cv=none; b=Yc1tjzUu1EM8y+izA/HyqOa0/0oMfilDem074O6VYua/0e+F0/ElgiM9WoK/yMGfYzm6HrgSTh/bUbfj8SYOYCCfdKjJw3DrS1E5lot6N5g7l6HqJrMrCk96D11O80gd4X0DreDvBd0n9mghMZEiN5FGO1BR1FZ26DCexzW2OVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763944744; c=relaxed/simple; bh=LwiAHc4RwoQe++kQcc8PBK9cT4Y5Hk4joSlyVBAPSm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hyVeFh/JapXG3YqVRXaC5t48uavkwz9a9f/E+ir8SPx8YTIoKnRiCSKY+M0i9a30Pm88W1JsXBKC6vR3CKxzrKs7VMg+XxihyvSbSudoqPMBCgbGfVae7To/UHOGLxTE7KlSGdXf51iy0pcAP2mNkn+HO1Bs222+7DN5rPoS8VQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GaFZ0Jv3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GaFZ0Jv3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C26AEC19421; Mon, 24 Nov 2025 00:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763944743; bh=LwiAHc4RwoQe++kQcc8PBK9cT4Y5Hk4joSlyVBAPSm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GaFZ0Jv3OhNzCf02ZN/BsrMtFHL9tyaoKn+po0F7OBSdecaQfGxsEZkvM87aKZLIS 6BD7gUC7AhasdQaQKmxH+pZsQel2f+7WwWviGGvifw65CujchUhN4//IeP4ylv0Q/w qsKQ9nmFwG3mw23Gb50vUJ/0eT7xjgpQI5sfkke66MT65JzoNntr8uEleMq0lQ9qBn dkf3yGsGOP8Dg+lOeTWFdD7A4BdB3c9c01f0T8pPMrKS4SlaSMNZJWTmqefFrS7U47 zVxH5G4xoDWevlC8QHustDaoMLHa3rQlXamBcwYuXK1kCuEY9Gl2m8fMbOQIdimf5G X/OK2FFH6rL6Q== From: Jisheng Zhang To: Doug Berger , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Linus Walleij , Bartosz Golaszewski , Hoan Tran , Andy Shevchenko , Daniel Palmer , Romain Perier , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , Robert Jarzmik , Kunihiko Hayashi , Masami Hiramatsu , Shubhrajyoti Datta , Srinivas Neeli , Michal Simek Cc: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Andy Shevchenko Subject: [PATCH v5 01/14] gpio: dwapb: Use modern PM macros Date: Mon, 24 Nov 2025 08:20:52 +0800 Message-ID: <20251124002105.25429-2-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251124002105.25429-1-jszhang@kernel.org> References: <20251124002105.25429-1-jszhang@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the modern PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are 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. Signed-off-by: Jisheng Zhang Acked-by: Linus Walleij Reviewed-by: Andy Shevchenko --- drivers/gpio/gpio-dwapb.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index b42ff46d292b..4986c465c9a8 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -79,7 +79,6 @@ struct dwapb_platform_data { unsigned int nports; }; =20 -#ifdef CONFIG_PM_SLEEP /* Store GPIO context across system-wide suspend/resume transitions */ struct dwapb_context { u32 data; @@ -92,7 +91,6 @@ struct dwapb_context { u32 int_deb; u32 wake_en; }; -#endif =20 struct dwapb_gpio_port_irqchip { unsigned int nr_irqs; @@ -103,9 +101,7 @@ struct dwapb_gpio_port { struct gpio_generic_chip chip; struct dwapb_gpio_port_irqchip *pirq; struct dwapb_gpio *gpio; -#ifdef CONFIG_PM_SLEEP struct dwapb_context *ctx; -#endif unsigned int idx; }; =20 @@ -363,7 +359,6 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 t= ype) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); @@ -378,9 +373,6 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsig= ned int enable) =20 return 0; } -#else -#define dwapb_irq_set_wake NULL -#endif =20 static const struct irq_chip dwapb_irq_chip =3D { .name =3D DWAPB_DRIVER_NAME, @@ -390,7 +382,7 @@ static const struct irq_chip dwapb_irq_chip =3D { .irq_set_type =3D dwapb_irq_set_type, .irq_enable =3D dwapb_irq_enable, .irq_disable =3D dwapb_irq_disable, - .irq_set_wake =3D dwapb_irq_set_wake, + .irq_set_wake =3D pm_sleep_ptr(dwapb_irq_set_wake), .flags =3D IRQCHIP_IMMUTABLE, GPIOCHIP_IRQ_RESOURCE_HELPERS, }; @@ -759,7 +751,6 @@ static int dwapb_gpio_probe(struct platform_device *pde= v) return 0; } =20 -#ifdef CONFIG_PM_SLEEP static int dwapb_gpio_suspend(struct device *dev) { struct dwapb_gpio *gpio =3D dev_get_drvdata(dev); @@ -844,15 +835,14 @@ static int dwapb_gpio_resume(struct device *dev) =20 return 0; } -#endif =20 -static SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, dwapb_gpio_suspend, - dwapb_gpio_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, + dwapb_gpio_suspend, dwapb_gpio_resume); =20 static struct platform_driver dwapb_gpio_driver =3D { .driver =3D { .name =3D DWAPB_DRIVER_NAME, - .pm =3D &dwapb_gpio_pm_ops, + .pm =3D pm_sleep_ptr(&dwapb_gpio_pm_ops), .of_match_table =3D dwapb_of_match, .acpi_match_table =3D dwapb_acpi_match, }, --=20 2.51.0