The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] tpm: svsm: constify tpm_chip_ops
@ 2026-05-05 20:27 David Windsor
  2026-05-06  7:20 ` Stefano Garzarella
  2026-05-09 19:02 ` Jarkko Sakkinen
  0 siblings, 2 replies; 3+ messages in thread
From: David Windsor @ 2026-05-05 20:27 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Jason Gunthorpe, linux-integrity, linux-kernel

Constify the SVSM vTPM ops. It is statically initialized and never
written to, so let's store it in .rodata.

Every other tpm_class_ops instance in drivers/char/tpm/ is already
const.

Signed-off-by: David Windsor <dwindsor@gmail.com>
---
 drivers/char/tpm/tpm_svsm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_svsm.c b/drivers/char/tpm/tpm_svsm.c
index f5ba0f64850b..b74d60f687d5 100644
--- a/drivers/char/tpm/tpm_svsm.c
+++ b/drivers/char/tpm/tpm_svsm.c
@@ -49,7 +49,7 @@ static int tpm_svsm_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
 	return svsm_vtpm_cmd_response_parse(priv->buffer, buf, bufsiz);
 }
 
-static struct tpm_class_ops tpm_chip_ops = {
+static const struct tpm_class_ops tpm_chip_ops = {
 	.flags = TPM_OPS_AUTO_STARTUP,
 	.send = tpm_svsm_send,
 };

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tpm: svsm: constify tpm_chip_ops
  2026-05-05 20:27 [PATCH] tpm: svsm: constify tpm_chip_ops David Windsor
@ 2026-05-06  7:20 ` Stefano Garzarella
  2026-05-09 19:02 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2026-05-06  7:20 UTC (permalink / raw)
  To: David Windsor
  Cc: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, linux-integrity,
	linux-kernel

On Tue, May 05, 2026 at 04:27:38PM -0400, David Windsor wrote:
>Constify the SVSM vTPM ops. It is statically initialized and never
>written to, so let's store it in .rodata.
>
>Every other tpm_class_ops instance in drivers/char/tpm/ is already
>const.
>
>Signed-off-by: David Windsor <dwindsor@gmail.com>
>---
> drivers/char/tpm/tpm_svsm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

LGTM!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tpm: svsm: constify tpm_chip_ops
  2026-05-05 20:27 [PATCH] tpm: svsm: constify tpm_chip_ops David Windsor
  2026-05-06  7:20 ` Stefano Garzarella
@ 2026-05-09 19:02 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2026-05-09 19:02 UTC (permalink / raw)
  To: David Windsor; +Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, linux-kernel

On Tue, May 05, 2026 at 04:27:38PM -0400, David Windsor wrote:
> Constify the SVSM vTPM ops. It is statically initialized and never
> written to, so let's store it in .rodata.
> 
> Every other tpm_class_ops instance in drivers/char/tpm/ is already
> const.
> 
> Signed-off-by: David Windsor <dwindsor@gmail.com>
> ---
>  drivers/char/tpm/tpm_svsm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_svsm.c b/drivers/char/tpm/tpm_svsm.c
> index f5ba0f64850b..b74d60f687d5 100644
> --- a/drivers/char/tpm/tpm_svsm.c
> +++ b/drivers/char/tpm/tpm_svsm.c
> @@ -49,7 +49,7 @@ static int tpm_svsm_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
>  	return svsm_vtpm_cmd_response_parse(priv->buffer, buf, bufsiz);
>  }
>  
> -static struct tpm_class_ops tpm_chip_ops = {
> +static const struct tpm_class_ops tpm_chip_ops = {
>  	.flags = TPM_OPS_AUTO_STARTUP,
>  	.send = tpm_svsm_send,
>  };
> 
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> -- 
> 2.53.0
> 

Thanks, applied.

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-09 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 20:27 [PATCH] tpm: svsm: constify tpm_chip_ops David Windsor
2026-05-06  7:20 ` Stefano Garzarella
2026-05-09 19:02 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox