From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Jisheng Zhang <jszhang@kernel.org>,
Doug Berger <opendmb@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Hoan Tran <hoan@os.amperecomputing.com>,
Andy Shevchenko <andy@kernel.org>,
Daniel Palmer <daniel@thingy.jp>,
Romain Perier <romain.perier@gmail.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Kevin Hilman <khilman@kernel.org>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
Srinivas Neeli <srinivas.neeli@amd.com>,
Michal Simek <michal.simek@amd.com>,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH v5 02/14] gpio: brcmstb: Use modern PM macros
Date: Mon, 24 Nov 2025 17:17:23 +0200 [thread overview]
Message-ID: <aSR3AwjQnB6EH7Nv@smile.fi.intel.com> (raw)
In-Reply-To: <CAOiHx==4NSMNVdW163nE-vYf_FtDjS5aHfj5chPr3n6D2Mt9Nw@mail.gmail.com>
On Mon, Nov 24, 2025 at 04:05:29PM +0100, Jonas Gorski wrote:
> On Mon, Nov 24, 2025 at 3:49 PM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > 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@gmail.com> wrote:
> > > > On Mon, Nov 24, 2025 at 2:40 PM Jonas Gorski <jonas.gorski@gmail.com> wrote:
> > > > > On Mon, Nov 24, 2025 at 1:39 AM Jisheng Zhang <jszhang@kernel.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?
>
> No, I just was working with old assumptions, so my bad. I faintly
> remember that they used to work that way, but maybe I also
> misremember. TIL. So disregard my comment.
NP. I'm glad everything is clear now about them.
> > > 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.)
>
> Maybe that some were using it was confusing me into thinking it is required.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-24 15:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 0:20 [PATCH v5 00/14] gpio: Use modern PM macros Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 01/14] gpio: dwapb: " Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 02/14] gpio: brcmstb: " Jisheng Zhang
2025-11-24 7:51 ` Andy Shevchenko
2025-11-24 12:40 ` Jonas Gorski
2025-11-24 13:52 ` Andy Shevchenko
2025-11-24 14:20 ` Jonas Gorski
2025-11-24 14:49 ` Andy Shevchenko
2025-11-24 15:05 ` Jonas Gorski
2025-11-24 15:17 ` Andy Shevchenko [this message]
2025-11-24 0:20 ` [PATCH v5 03/14] gpio: htc-egpio: " Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 04/14] gpio: pl061: " Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 05/14] gpio: ml-ioh: " Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 06/14] gpio: mlxbf2: " Jisheng Zhang
2025-11-24 0:20 ` [PATCH v5 07/14] gpio: msc313: " Jisheng Zhang
2025-12-03 8:10 ` Daniel Palmer
2025-11-24 0:20 ` [PATCH v5 08/14] gpio: omap: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 09/14] gpio: pch: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 10/14] gpio: tqmx86: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 11/14] gpio: uniphier: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 12/14] gpio: xgene: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 13/14] gpio: xilinx: " Jisheng Zhang
2025-11-24 0:21 ` [PATCH v5 14/14] gpio: zynq: " Jisheng Zhang
2025-11-25 13:11 ` [PATCH v5 00/14] gpio: " Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aSR3AwjQnB6EH7Nv@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=brgl@bgdev.pl \
--cc=daniel@thingy.jp \
--cc=florian.fainelli@broadcom.com \
--cc=grygorii.strashko@ti.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=hoan@os.amperecomputing.com \
--cc=jonas.gorski@gmail.com \
--cc=jszhang@kernel.org \
--cc=khilman@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=michal.simek@amd.com \
--cc=opendmb@gmail.com \
--cc=robert.jarzmik@free.fr \
--cc=romain.perier@gmail.com \
--cc=shubhrajyoti.datta@amd.com \
--cc=srinivas.neeli@amd.com \
--cc=ssantosh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).