]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tpm: svsm: constify tpm_chip_ops
authorDavid Windsor <dwindsor@gmail.com>
Tue, 5 May 2026 20:27:38 +0000 (16:27 -0400)
committerJarkko Sakkinen <jarkko@kernel.org>
Sun, 21 Jun 2026 01:25:27 +0000 (04:25 +0300)
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>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20260505202738.145800-1-dwindsor@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm_svsm.c

index f5ba0f64850b94bd45bef9d3a84cecf6f1056b32..b74d60f687d5b9813da09196680d5e9abca94b28 100644 (file)
@@ -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,
 };