thermal: intel_powerclamp: Constify static thermal_cooling_device_ops
PATCH 1/1 thermal: intel_powerclamp: Constify static thermal_cooling_device_ops
The only usage of powerclamp_cooling_ops is to pass its address to thermal_cooling_device_register(), which takes a pointer to const struct thermal_cooling_device_ops. Make it const to allow the compiler to put it in read-only memory.
--- drivers/thermal/intel/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_powerclamp.c +1 -1
@@ -641,7 +641,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, }/* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = { .get_max_state = powerclamp_get_max_state, .get_cur_state = powerclamp_get_cur_state, .set_cur_state = powerclamp_set_cur_state,
Signature · 1 line
2.34.1
Daniel Lezcano
AppliedQuoted 6 lines · Rikard Falkeborn
The only usage of
powerclamp_cooling_opsis to pass its address tothermal_cooling_device_register(), which takes a pointer to const structthermal_cooling_device_ops. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Applied, thanks
Quoted 18 lines
--- drivers/thermal/intel/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel/intel_powerclamp.c +1
-1@@ -641,7 +641,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, }/* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = { .get_max_state = powerclamp_get_max_state, .get_cur_state = powerclamp_get_cur_state, .set_cur_state = powerclamp_set_cur_state,
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
[thermal: thermal/next] thermal/drivers/intel_powerclamp: Constify static thermal_cooling_device_ops
In reply to Rikard FalkebornThe following commit has been merged into the thermal/next branch of thermal:
The following commit has been merged into the thermal/next branch of thermal:
Commit-ID: 8152d2a9e73deb2b483bef9035d53ded27f50317 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8152d2a9e73deb2b483bef9035d53ded27f50317 Author: Rikard Falkeborn <[email protected]> AuthorDate: Sun, 28 Nov 2021 22:46:41 +01:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Tue, 30 Nov 2021 15:42:39 +01:00
thermal/drivers/intel_powerclamp: Constify static thermal_cooling_device_ops
The only usage of powerclamp_cooling_ops is to pass its address to thermal_cooling_device_register(), which takes a pointer to const struct thermal_cooling_device_ops. Make it const to allow the compiler to put it in read-only memory.
--- drivers/thermal/intel/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/intel_powerclamp.c +1 -1
@@ -641,7 +641,7 @@ exit_set: }/* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = { .get_max_state = powerclamp_get_max_state, .get_cur_state = powerclamp_get_cur_state, .set_cur_state = powerclamp_set_cur_state,