Skip to contentSkip to conversation

memory: tegra: Constify struct thermal_cooling_device_ops

PATCH Applied Rikard Falkeborn 2 participants 2 messages Nov 28, 2021 – Nov 29, 2021

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

PATCH 1/1 memory: tegra: Constify struct thermal_cooling_device_ops

The only usage of tegra210_emc_cd_ops is to pass its address to devm_thermal_of_cooling_device_register() which is a pointer to const struct thermal_cooling_device_ops. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/memory/tegra/tegra210-emc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/tegra/tegra210-emc-core.c +1 -1
index 13584f9317a4..cbe1a7723514 100644
@@ -711,7 +711,7 @@ static int tegra210_emc_cd_set_state(struct thermal_cooling_device *cd,
 	return 0;
 }
 
-static struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
+static const struct thermal_cooling_device_ops tegra210_emc_cd_ops = {
 	.get_max_state = tegra210_emc_cd_max_state,
 	.get_cur_state = tegra210_emc_cd_get_state,
 	.set_cur_state = tegra210_emc_cd_set_state,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Rikard Falkeborn

The only usage of tegra210_emc_cd_ops is to pass its address to devm_thermal_of_cooling_device_register() which is a pointer to const struct thermal_cooling_device_ops. Make it const to allow the compiler to put it in read-only memory.

Applied, thanks!

[1/1] memory: tegra: Constify struct thermal_cooling_device_ops

      commit: 56985dc4f437d7a77d4abede73191da20cf11429

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>