From nobody Tue Dec 2 02:31:02 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 EF9232877E8; Wed, 19 Nov 2025 15:01:29 +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=1763564490; cv=none; b=U/gEv9af4w3vhuydAS6swBiWkXolQhocgRiqyXxOqBzX18mLnI5rOgAKq62ZDqyWIXR4seD7aLiqnd8irtugPvuVF9wGPmTiIq23MZBWl9/JBysy0Nlt1PkJHBtx0mMWO+v00h/3tJi4UlgW7muEqJbvY8AkgNH+pFlcPebCyxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763564490; c=relaxed/simple; bh=v9W8D36bTqpg+f65pHNpmPN8TfSCoWh/X0xcXoN9wTA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E1HaVS0a1DLDJe7Tpg+Ojgy45TBGfzYgcLk496QOSPWVuXXhH5eqJNtsJRZTHlAOeR6EC8kG6cwhmxkrEF01fRwpYzzQ59SqEJvflO2YvDYTre3lvIoRx2mCv7gYe0cLCWuiuFJNGhmPDE9ySgLAZa6IlzQiAsqnuhlNt+dkYOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IbmFVijy; 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="IbmFVijy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8759C113D0; Wed, 19 Nov 2025 15:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763564489; bh=v9W8D36bTqpg+f65pHNpmPN8TfSCoWh/X0xcXoN9wTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IbmFVijy9Gho98tZFFCzSIywVPOUXae5n0xMw7s4R/dPFOMhyBpN0gCw1Rlcnt/VL nH8UX9Tig5hkKSQssrFQmpuyeC4+E21+CikqJVyijFasF3TTJcbMlRjj2+vwf43uuX q76p++y9aGy/Fr5ObtkTdJ53w1ZXmPFM1/I6umOljaQWWeFzNQRTRA+39VRk2A0fiG M0apB+w4udhKu9joXIuaJbZla3XfwMDHAxRi7mJFlT+M5LBJIC9oJGZ5xDOOhj9Zir FzOZqyfzLGqiI38XmT+oXAYaGL4VdIwWkD2QPZtCj2++1d/6N1tw0B57syQkXezgJf mLM/WDnELFmZQ== 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 Subject: [PATCH v3 01/15] gpio: dwapb: Use modern PM macros Date: Wed, 19 Nov 2025 22:43:13 +0800 Message-ID: <20251119144327.13345-2-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251119144327.13345-1-jszhang@kernel.org> References: <20251119144327.13345-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 --- 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