Skip to contentSkip to conversation

soc: qcom: aoss: constify static struct thermal_cooling_device_ops

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

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

PATCH 1/1 soc: qcom: aoss: constify static struct thermal_cooling_device_ops

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

---
 drivers/soc/qcom/qcom_aoss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +1 -1
index 34acf58bbb0d..cbe5e39fdaeb 100644
@@ -352,7 +352,7 @@ static int qmp_cdev_set_cur_state(struct thermal_cooling_device *cdev,
 	return ret;
 }
 
-static struct thermal_cooling_device_ops qmp_cooling_device_ops = {
+static const struct thermal_cooling_device_ops qmp_cooling_device_ops = {
 	.get_max_state = qmp_cdev_get_max_state,
 	.get_cur_state = qmp_cdev_get_cur_state,
 	.set_cur_state = qmp_cdev_set_cur_state,
Signature · 1 line
2.34.1
#1 lore raw

Re: (subset) [PATCH] soc: qcom: aoss: constify static struct thermal_cooling_device_ops

Quoted 6 lines · Rikard Falkeborn

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

Applied, thanks!

[1/1] soc: qcom: aoss: constify static struct thermal_cooling_device_ops

      commit: f5c3902d854744b42604359f68b42426185ed7a5

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>