[PATCH] accel/amdxdna: Constify struct xrs_action_ops
From: Christophe JAILLET
Date: Sun Aug 09 2026 - 12:18:24 EST
'struct xrs_action_ops' is not modified in this driver.
Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.
On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
55888 17696 0 73584 11f70 drivers/accel/amdxdna/aie2_pci.o
After:
=====
text data bss dec hex filename
55952 17632 0 73584 11f70 drivers/accel/amdxdna/aie2_pci.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
Compile tested only.
---
drivers/accel/amdxdna/aie2_pci.c | 2 +-
drivers/accel/amdxdna/aie2_solver.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index daec1f6b4907..71045c72df60 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -285,7 +285,7 @@ static int aie2_xrs_set_dft_dpm_level(struct drm_device *ddev, u32 dpm_level)
return aie2_pm_set_dpm(ndev, dpm_level);
}
-static struct xrs_action_ops aie2_xrs_actions = {
+static const struct xrs_action_ops aie2_xrs_actions = {
.load = aie2_xrs_load,
.unload = aie2_xrs_unload,
.set_dft_dpm_level = aie2_xrs_set_dft_dpm_level,
diff --git a/drivers/accel/amdxdna/aie2_solver.h b/drivers/accel/amdxdna/aie2_solver.h
index a2e3c52229e9..0b1ca7a4b800 100644
--- a/drivers/accel/amdxdna/aie2_solver.h
+++ b/drivers/accel/amdxdna/aie2_solver.h
@@ -111,7 +111,7 @@ struct init_config {
u32 latency_adj; /* latency adjustment in ms */
struct clk_list_info clk_list; /* List of frequencies available in system */
struct drm_device *ddev;
- struct xrs_action_ops *actions;
+ const struct xrs_action_ops *actions;
};
/*
--
2.55.0