lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aSRwXCfG1RimQZxX@smile.fi.intel.com>
Date: Mon, 24 Nov 2025 16:49:00 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Jonas Gorski <jonas.gorski@...il.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
	Jisheng Zhang <jszhang@...nel.org>, Doug Berger <opendmb@...il.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	bcm-kernel-feedback-list@...adcom.com,
	Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Hoan Tran <hoan@...amperecomputing.com>,
	Andy Shevchenko <andy@...nel.org>, Daniel Palmer <daniel@...ngy.jp>,
	Romain Perier <romain.perier@...il.com>,
	Grygorii Strashko <grygorii.strashko@...com>,
	Santosh Shilimkar <ssantosh@...nel.org>,
	Kevin Hilman <khilman@...nel.org>,
	Robert Jarzmik <robert.jarzmik@...e.fr>,
	Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Shubhrajyoti Datta <shubhrajyoti.datta@....com>,
	Srinivas Neeli <srinivas.neeli@....com>,
	Michal Simek <michal.simek@....com>, linux-gpio@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-omap@...r.kernel.org
Subject: Re: [PATCH v5 02/14] gpio: brcmstb: Use modern PM macros

On Mon, Nov 24, 2025 at 03:20:00PM +0100, Jonas Gorski wrote:
> On Mon, Nov 24, 2025 at 2:52 PM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> > On Mon, Nov 24, 2025 at 2:40 PM Jonas Gorski <jonas.gorski@...il.com> wrote:
> > > On Mon, Nov 24, 2025 at 1:39 AM Jisheng Zhang <jszhang@...nel.org> wrote:

...

> > > >  static const struct dev_pm_ops brcmstb_gpio_pm_ops = {
> > > > -       .suspend_noirq  = brcmstb_gpio_suspend,
> > > > -       .resume_noirq = brcmstb_gpio_resume,
> > > > +       .suspend_noirq = pm_sleep_ptr(brcmstb_gpio_suspend),
> > > > +       .resume_noirq = pm_sleep_ptr(brcmstb_gpio_resume),
> > > >  };

...

> > > > -               .pm = &brcmstb_gpio_pm_ops,
> > > > +               .pm = pm_sleep_ptr(&brcmstb_gpio_pm_ops),
> > >
> > > won't this cause a "brcmstb_gpio_pm_ops is unused" compile warning for
> > > !CONFIG_PM_SLEEP?
> > >
> > > You probably need to add a __maybe_unused to brcmstb_gpio_pm_ops
> > > (which incidentally DEFINE_NOIRQ_DEV_PM_OPS() also doesn't set, but
> > > all other *_DEV_PM_OPS() macros do).

Do they? I mean the modern ones and not that are deprecated.

> > Shouldn't it be covered by the same trick as pm_sleep_ptr() does for functions?
> 
> pm_sleep_ptr() becomes NULL for !CONFIG_PM_SLEEP, so there is no
> reference then anymore to brcmstb_gpio_pm_ops. You would need a
> wrapper for brcmstb_gpio_pm_ops itself to conditionally define it to
> avoid the warning, or add __maybe_unused to it to silence it.

PTR_IF() magic is exactly to make sure compiler will have a visibility while
dropping a dead code. Did I miss anything?

> Note how SIMPLE_DEV_PM_OPS() and UNIVERSAL_DEV_PM_OPS() tag the struct
> with it (for that reason I assume).

Both are deprecated. Not a good orienteer.
None of the new approach uses __maybe_unused. (See DEFINE_*() macros in pm.h.)

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ