diff mbox series

thermal: intel_powerclamp: Constify static thermal_cooling_device_ops

Message ID 20211128214641.30953-1-rikard.falkeborn@gmail.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series thermal: intel_powerclamp: Constify static thermal_cooling_device_ops | expand

Commit Message

Rikard Falkeborn Nov. 28, 2021, 9:46 p.m. UTC
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.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/thermal/intel/intel_powerclamp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Lezcano Nov. 29, 2021, 10:04 a.m. UTC | #1
On 28/11/2021 22:46, Rikard Falkeborn wrote:
> 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.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Applied, thanks

> ---
>  drivers/thermal/intel/intel_powerclamp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 9b68489a2356..14256421d98c 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -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,
>
diff mbox series

Patch

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 9b68489a2356..14256421d98c 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -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,