Linux EFI development
 help / color / mirror / Atom feed
* [PATCH] efi: stmm: Constify struct efivar_operations
@ 2026-02-15 11:06 Krzysztof Kozlowski
  2026-02-16  9:49 ` Ilias Apalodimas
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-15 11:06 UTC (permalink / raw)
  To: Ard Biesheuvel, Maxime Coquelin, Alexandre Torgue, linux-efi,
	linux-stm32, linux-arm-kernel, linux-kernel
  Cc: Krzysztof Kozlowski

The 'struct efivar_operations' is not modified by the driver after
initialization, so it should follow typical practice of being static
const for increased code safety and readability.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/firmware/efi/stmm/tee_stmm_efi.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/efi/stmm/tee_stmm_efi.c b/drivers/firmware/efi/stmm/tee_stmm_efi.c
index 7b04dd649629..3bea2ef50ef3 100644
--- a/drivers/firmware/efi/stmm/tee_stmm_efi.c
+++ b/drivers/firmware/efi/stmm/tee_stmm_efi.c
@@ -14,7 +14,6 @@
 #include "mm_communication.h"
 
 static struct efivars tee_efivars;
-static struct efivar_operations tee_efivar_ops;
 
 static size_t max_buffer_size; /* comm + var + func + data */
 static size_t max_payload_size; /* func + data */
@@ -520,6 +519,15 @@ static void tee_stmm_restore_efivars_generic_ops(void)
 	efivars_generic_ops_register();
 }
 
+static const struct efivar_operations tee_efivar_ops = {
+	.get_variable			= tee_get_variable,
+	.get_next_variable		= tee_get_next_variable,
+	.set_variable			= tee_set_variable,
+	.set_variable_nonblocking	= tee_set_variable_nonblocking,
+	.query_variable_store		= efi_query_variable_store,
+	.query_variable_info		= tee_query_variable_info,
+};
+
 static int tee_stmm_efi_probe(struct tee_client_device *tee_dev)
 {
 	struct device *dev = &tee_dev->dev;
@@ -558,13 +566,6 @@ static int tee_stmm_efi_probe(struct tee_client_device *tee_dev)
 			  MM_VARIABLE_COMMUNICATE_SIZE +
 			  max_payload_size;
 
-	tee_efivar_ops.get_variable		= tee_get_variable;
-	tee_efivar_ops.get_next_variable	= tee_get_next_variable;
-	tee_efivar_ops.set_variable		= tee_set_variable;
-	tee_efivar_ops.set_variable_nonblocking	= tee_set_variable_nonblocking;
-	tee_efivar_ops.query_variable_store	= efi_query_variable_store;
-	tee_efivar_ops.query_variable_info	= tee_query_variable_info;
-
 	efivars_generic_ops_unregister();
 	pr_info("Using TEE-based EFI runtime variable services\n");
 	efivars_register(&tee_efivars, &tee_efivar_ops);
-- 
2.51.0


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

end of thread, other threads:[~2026-02-17 12:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 11:06 [PATCH] efi: stmm: Constify struct efivar_operations Krzysztof Kozlowski
2026-02-16  9:49 ` Ilias Apalodimas
2026-02-16 10:33   ` Krzysztof Kozlowski
2026-02-16 10:43     ` Ilias Apalodimas
2026-02-16 11:07       ` Krzysztof Kozlowski
2026-02-17 11:30         ` Ard Biesheuvel
2026-02-17 12:25           ` Krzysztof Kozlowski
2026-02-17 12:34             ` Krzysztof Kozlowski

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