Skip to contentSkip to conversation

ARM: prima2: Constify static sirfsoc_rstc_ops

PATCH In review Rikard Falkeborn 2 participants 2 messages Sep 29, 2020 – Sep 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: prima2: Constify static sirfsoc_rstc_ops

The only usage of sirfsoc_rstc_ops is to assign its address to the ops field in the reset_controller_dev struct, which is a const pointer. Make it const to allow the compiler to put it in read-only memory.

---
 arch/arm/mach-prima2/rstc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-prima2/rstc.c +1 -1
index 9d56606ac87f..1ee405e2dde9 100644
@@ -53,7 +53,7 @@ static int sirfsoc_reset_module(struct reset_controller_dev *rcdev,
 	return 0;
 }
 
-static struct reset_control_ops sirfsoc_rstc_ops = {
+static const struct reset_control_ops sirfsoc_rstc_ops = {
 	.reset = sirfsoc_reset_module,
 };
 
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Rikard,

Quoted 5 lines · Rikard Falkeborn

The only usage of sirfsoc_rstc_ops is to assign its address to the ops field in the reset_controller_dev struct, which is a const pointer. Make it const to allow the compiler to put it in read-only memory.

Quoted 9 lines
---
 arch/arm/mach-prima2/rstc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-prima2/rstc.c +0 -0
index 9d56606ac87f..1ee405e2dde9 100644

arch/arm/mach-prima2/rstc.c static int sirfsoc_reset_module(struct reset_controller_dev *rcdev, · line 59

Quoted 8 lines
arch/arm/mach-prima2/rstc.c +1 -1
@@ -53,7 +53,7 @@ static int sirfsoc_reset_module(struct reset_controller_dev *rcdev,
 	return 0;
 }
 
-static struct reset_control_ops sirfsoc_rstc_ops = {
+static const struct reset_control_ops sirfsoc_rstc_ops = {
 	.reset = sirfsoc_reset_module,
 };
 

regards
Philipp