From: Jarkko Sakkinen <jarkko@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Li Jun <lijun01@kylinos.cn>,
peterhuewe@gmx.de, jgg@ziepe.ca, linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2] tpm: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr()
Date: Fri, 18 Sep 2026 05:43:16 +0300 [thread overview]
Message-ID: <aqylRLC72F58oG6Z@kernel.org> (raw)
In-Reply-To: <aqyjp9A3tk3l9AI1@kernel.org>
On Fri, Sep 18, 2026 at 05:36:27AM +0300, Jarkko Sakkinen wrote:
> On Mon, Sep 14, 2026 at 04:36:01PM -0700, Nathan Chancellor wrote:
> > On Wed, Sep 09, 2026 at 04:24:59PM +0800, Li Jun wrote:
> > > Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS
> > > and wrap the struct assignment with pm_sleep_ptr(). The old code keeps
> > > a completely empty dev_pm_ops structure -- all callbacks are NULL --
> > > as dead code in the object file when CONFIG_PM_SLEEP=n, because
> > > SET_SYSTEM_SLEEP_PM_OPS() expands to nothing while __maybe_unused on
> > > the struct only silences the warning without removing the struct.
> > > Switching to DEFINE_SIMPLE_DEV_PM_OPS() lets pm_sleep_ptr() eliminate
> > > the callback references at compile time, and wrapping the struct
> > > assignment with pm_sleep_ptr() drops the entire structure when
> > > CONFIG_PM_SLEEP is disabled, instead of retaining an empty one.
> > >
> > > Signed-off-by: Li Jun <lijun01@kylinos.cn>
> > ...
> > > diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
> > > index 7638b65b851b..84a0d3e5f679 100644
> > > --- a/drivers/char/tpm/tpm_infineon.c
> > > +++ b/drivers/char/tpm/tpm_infineon.c
> > > @@ -612,7 +612,7 @@ static int tpm_inf_resume(struct device *dev)
> > > return tpm_pm_resume(dev);
> > > }
> > > #endif
> > > -static SIMPLE_DEV_PM_OPS(tpm_inf_pm, tpm_pm_suspend, tpm_inf_resume);
> > > +static DEFINE_SIMPLE_DEV_PM_OPS(tpm_inf_pm, tpm_pm_suspend, tpm_inf_resume);
> > >
> > > static struct pnp_driver tpm_inf_pnp_driver = {
> > > .name = "tpm_inf_pnp",
> > > @@ -620,7 +620,7 @@ static struct pnp_driver tpm_inf_pnp_driver = {
> > > .probe = tpm_inf_pnp_probe,
> > > .remove = tpm_inf_pnp_remove,
> > > .driver = {
> > > - .pm = &tpm_inf_pm,
> > > + .pm = pm_sleep_ptr(&tpm_inf_pm),
> > > }
> > > };
> > >
> >
> > This patch is in -next as commit 2249200ee420 ("tpm: use
> > DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr()"), where it breaks the build
> > for CONFIG_PM_SLEEP=n kernels because some of the functions are not
> > visible in these configurations.
> >
> > https://lore.kernel.org/202609121207.tM2OfBmR-lkp@intel.com/
> > https://lore.kernel.org/202609121338.qo2mQWRl-lkp@intel.com/
> >
> > It should be fairly easy enough to expose these functions regardless of
> > CONFIG_PM_SLEEP (or add some stubs) but I think this patch should be
> > dropped until it can be done in a new version.
> >
> > --
> > Cheers,
> > Nathan
>
> See:
>
> https://lore.kernel.org/linux-integrity/aqyOUgIa4lsUwO0I@kernel.org/
>
> So I would squash Arnd's fixes and call it a day?
The fire has been extinguished anyhow.
I.e. I updated for-next-tpm not to have Li's patch.
The patch and Arnd's fixes to it remain in my master branch instead.
BR, Jarkko
prev parent reply other threads:[~2026-09-18 2:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 8:24 [PATCH v2] tpm: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr() Li Jun
2026-09-09 22:56 ` Jarkko Sakkinen
2026-09-14 23:36 ` Nathan Chancellor
2026-09-15 1:23 ` lijun
2026-09-18 2:36 ` Jarkko Sakkinen
2026-09-18 2:43 ` Jarkko Sakkinen [this message]
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=aqylRLC72F58oG6Z@kernel.org \
--to=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=lijun01@kylinos.cn \
--cc=linux-integrity@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=peterhuewe@gmx.de \
/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