* [PATCH] tpm: ibmvtpm: Fix unused suspend callback with CONFIG_PM_SLEEP=n
@ 2026-11-27 1:01 Zhouyi Zhou
2026-11-27 4:42 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Zhouyi Zhou @ 2026-11-27 1:01 UTC (permalink / raw)
To: jarkko, peterhuewe
Cc: lance, rcu, Zhouyi Zhou, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Jason Gunthorpe,
linuxppc-dev, linux-integrity, Li Jun
Discovered in the Open Source Lab of Oregon State University when running
RCU torture.sh on a ppc64le VM.
With CONFIG_TCG_IBMVTPM=y and CONFIG_PM_SLEEP disabled, SIMPLE_DEV_PM_OPS()
omits the references to the system sleep callbacks. This leaves
tpm_ibmvtpm_suspend() unused and produces the following warning:
warning: 'tpm_ibmvtpm_suspend' defined but not used [-Wunused-function]
Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() so that the compiler
sees the callback references and can discard the unused PM code when
system sleep is disabled. Preserve tpm_ibmvtpm_resume(), which is also
called directly from tpm_ibmvtpm_send().
Tested on PPC VM of the Open Source Lab
of Oregon State University.
Fixes: fc0ddb3174b0 ("char: tpm: Use SIMPLE_DEV_PM_OPS for ibmvtpm power management")
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
---
drivers/char/tpm/tpm_ibmvtpm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 51c7e2add3d2..9840d0ebe6a3 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -462,7 +462,8 @@ static const struct tpm_class_ops tpm_ibmvtpm = {
.req_canceled = tpm_ibmvtpm_req_canceled,
};
-static SIMPLE_DEV_PM_OPS(tpm_ibmvtpm_pm_ops, tpm_ibmvtpm_suspend, tpm_ibmvtpm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tpm_ibmvtpm_pm_ops,
+ tpm_ibmvtpm_suspend, tpm_ibmvtpm_resume);
/**
* ibmvtpm_crq_get_next - Get next responded crq
@@ -714,7 +715,7 @@ static struct vio_driver ibmvtpm_driver = {
.remove = tpm_ibmvtpm_remove,
.get_desired_dma = tpm_ibmvtpm_get_desired_dma,
.name = tpm_ibmvtpm_driver_name,
- .pm = &tpm_ibmvtpm_pm_ops,
+ .pm = pm_sleep_ptr(&tpm_ibmvtpm_pm_ops),
};
/**
base-commit: 5f22fb20497f4983094131f00a734362300d22d2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tpm: ibmvtpm: Fix unused suspend callback with CONFIG_PM_SLEEP=n
2026-11-27 1:01 [PATCH] tpm: ibmvtpm: Fix unused suspend callback with CONFIG_PM_SLEEP=n Zhouyi Zhou
@ 2026-11-27 4:42 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2026-11-27 4:42 UTC (permalink / raw)
To: Zhouyi Zhou
Cc: peterhuewe, lance, rcu, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM), Shrikanth Hegde, Jason Gunthorpe,
linuxppc-dev, linux-integrity, Li Jun
On Fri, Nov 27, 2026 at 01:01:24AM +0000, Zhouyi Zhou wrote:
> Discovered in the Open Source Lab of Oregon State University when running
> RCU torture.sh on a ppc64le VM.
>
> With CONFIG_TCG_IBMVTPM=y and CONFIG_PM_SLEEP disabled, SIMPLE_DEV_PM_OPS()
> omits the references to the system sleep callbacks. This leaves
> tpm_ibmvtpm_suspend() unused and produces the following warning:
>
> warning: 'tpm_ibmvtpm_suspend' defined but not used [-Wunused-function]
>
> Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() so that the compiler
> sees the callback references and can discard the unused PM code when
> system sleep is disabled. Preserve tpm_ibmvtpm_resume(), which is also
> called directly from tpm_ibmvtpm_send().
>
> Tested on PPC VM of the Open Source Lab
> of Oregon State University.
>
> Fixes: fc0ddb3174b0 ("char: tpm: Use SIMPLE_DEV_PM_OPS for ibmvtpm power management")
>
nit: should not have empty line here.
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> ---
> drivers/char/tpm/tpm_ibmvtpm.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
> index 51c7e2add3d2..9840d0ebe6a3 100644
> --- a/drivers/char/tpm/tpm_ibmvtpm.c
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -462,7 +462,8 @@ static const struct tpm_class_ops tpm_ibmvtpm = {
> .req_canceled = tpm_ibmvtpm_req_canceled,
> };
>
> -static SIMPLE_DEV_PM_OPS(tpm_ibmvtpm_pm_ops, tpm_ibmvtpm_suspend, tpm_ibmvtpm_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(tpm_ibmvtpm_pm_ops,
> + tpm_ibmvtpm_suspend, tpm_ibmvtpm_resume);
I'd keep these in same line.
>
> /**
> * ibmvtpm_crq_get_next - Get next responded crq
> @@ -714,7 +715,7 @@ static struct vio_driver ibmvtpm_driver = {
> .remove = tpm_ibmvtpm_remove,
> .get_desired_dma = tpm_ibmvtpm_get_desired_dma,
> .name = tpm_ibmvtpm_driver_name,
> - .pm = &tpm_ibmvtpm_pm_ops,
> + .pm = pm_sleep_ptr(&tpm_ibmvtpm_pm_ops),
> };
>
> /**
>
> base-commit: 5f22fb20497f4983094131f00a734362300d22d2
Otherwise, it's good.
Br, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 4:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 1:01 [PATCH] tpm: ibmvtpm: Fix unused suspend callback with CONFIG_PM_SLEEP=n Zhouyi Zhou
2026-11-27 4:42 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox