[PATCH v3 05/15] gpio: pxa: Use modern PM macros

Jisheng Zhang jszhang at kernel.org
Wed Nov 19 07:58:19 PST 2025


On Wed, Nov 19, 2025 at 05:47:41PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 19, 2025 at 10:43:17PM +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.
> 
> ...
> 
> > struct pxa_gpio_bank {
> 
> ...
> 
> >  	unsigned long	irq_mask;
> >  	unsigned long	irq_edge_rise;
> >  	unsigned long	irq_edge_fall;
> 
> > -
> 
> As I already pointed out this is stray change. Why you ignored my comment?
> 
> > -#ifdef CONFIG_PM
> >  	unsigned long	saved_gplr;
> >  	unsigned long	saved_gpdr;
> >  	unsigned long	saved_grer;
> >  	unsigned long	saved_gfer;
> > -#endif
> 
> Same Q as per dwapb driver. The CONFIG_PM=n doesn't need these.

Now, I know why you commented like these... 
the pm_ptr() and pm_sleep_ptr() can optimize out the PM
functions, but those functions still need to be compiled. So if
we keep these #ifdef, there will be build errors in case of !PM

> 
> >  };
> 
> ...
> 
> >  static struct syscore_ops pxa_gpio_syscore_ops = {
> > -	.suspend	= pxa_gpio_suspend,
> > -	.resume		= pxa_gpio_resume,
> > +	.suspend	= pm_ptr(pxa_gpio_suspend),
> > +	.resume		= pm_ptr(pxa_gpio_resume),
> >  };
> 
> This is not a device PM ops actually. Is there any guarantees on the
> relationship with CONFIG_PM and these callbacks? If so, I think we
> need to have special macros somewhere in include/linux/syscore_ops.h.
> 
> Otherwise I'm not sure this will be a good patch at all.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 



More information about the linux-arm-kernel mailing list