linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: intel_powerclamp: Constify static thermal_cooling_device_ops
@ 2021-11-28 21:46 Rikard Falkeborn
  2021-11-29 10:04 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2021-11-28 21:46 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Daniel Lezcano, Amit Kucheria, Zhang Rui, linux-pm, linux-kernel,
	Rikard Falkeborn

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(-)

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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] thermal: intel_powerclamp: Constify static thermal_cooling_device_ops
  2021-11-28 21:46 [PATCH] thermal: intel_powerclamp: Constify static thermal_cooling_device_ops Rikard Falkeborn
@ 2021-11-29 10:04 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2021-11-29 10:04 UTC (permalink / raw)
  To: Rikard Falkeborn, Rafael J. Wysocki
  Cc: Amit Kucheria, Zhang Rui, linux-pm, linux-kernel

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,
> 


-- 
<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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-29 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-28 21:46 [PATCH] thermal: intel_powerclamp: Constify static thermal_cooling_device_ops Rikard Falkeborn
2021-11-29 10:04 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).