[PATCH v3 01/15] gpio: dwapb: Use modern PM macros
Jisheng Zhang
jszhang at kernel.org
Wed Nov 19 07:51:39 PST 2025
On Wed, Nov 19, 2025 at 05:42:59PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 19, 2025 at 10:43:13PM +0800, Jisheng Zhang wrote:
> > 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.
>
> ...
>
> > -#ifdef CONFIG_PM_SLEEP
> > /* Store GPIO context across system-wide suspend/resume transitions */
> > struct dwapb_context {
> > u32 data;
>
> > u32 int_deb;
> > u32 wake_en;
> > };
> > -#endif
>
> This ifdeffery is to protect the type definition? It may be removed for sure.
>
> ...
>
> > struct dwapb_gpio_port_irqchip {
> > unsigned int nr_irqs;
>
> > struct gpio_generic_chip chip;
> > struct dwapb_gpio_port_irqchip *pirq;
> > struct dwapb_gpio *gpio;
> > -#ifdef CONFIG_PM_SLEEP
> > struct dwapb_context *ctx;
> > -#endif
>
> But why this? For the PM_SLEEP=n cases it will give an unrequested overhead.
the pm_ptr() and pm_sleep_ptr() can optimize out the PM related
functions, but those functions are still compiled, so if we keep the
#ifdef, there will be build errors.
>
> > unsigned int idx;
> > };
>
> Otherwise LGTM.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
More information about the linux-arm-kernel
mailing list