mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops
@ 2026-08-08 20:23 Christophe JAILLET
  2026-08-10 19:09 ` Frank Li
  2026-09-18 10:16 ` Daniel Lezcano
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2026-08-08 20:23 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pm, imx,
	linux-arm-kernel

'struct thermal_zone_device_ops' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   8567	   2144	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   8695	   2016	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/thermal/imx91_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c
index 25915bb702be..892a25440e06 100644
--- a/drivers/thermal/imx91_thermal.c
+++ b/drivers/thermal/imx91_thermal.c
@@ -225,7 +225,7 @@ static int imx91_tmu_change_mode(struct thermal_zone_device *tz, enum thermal_de
 	return 0;
 }
 
-static struct thermal_zone_device_ops tmu_tz_ops = {
+static const struct thermal_zone_device_ops tmu_tz_ops = {
 	.get_temp = imx91_tmu_get_temp,
 	.change_mode = imx91_tmu_change_mode,
 	.set_trips = imx91_tmu_set_trips,
-- 
2.55.0


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

* Re: [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops
  2026-08-08 20:23 [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops Christophe JAILLET
@ 2026-08-10 19:09 ` Frank Li
  2026-09-18 10:16 ` Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-08-10 19:09 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-kernel, kernel-janitors, linux-pm, imx, linux-arm-kernel

On Sat, Aug 08, 2026 at 10:23:33PM +0200, Christophe JAILLET wrote:
> 'struct thermal_zone_device_ops' is not modified in this driver.
>
> Constifying this structure moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
>
> On a x86_64, with allmodconfig:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>    8567	   2144	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o
>
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>    8695	   2016	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Compile tested only.
> ---
>  drivers/thermal/imx91_thermal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c
> index 25915bb702be..892a25440e06 100644
> --- a/drivers/thermal/imx91_thermal.c
> +++ b/drivers/thermal/imx91_thermal.c
> @@ -225,7 +225,7 @@ static int imx91_tmu_change_mode(struct thermal_zone_device *tz, enum thermal_de
>  	return 0;
>  }
>
> -static struct thermal_zone_device_ops tmu_tz_ops = {
> +static const struct thermal_zone_device_ops tmu_tz_ops = {
>  	.get_temp = imx91_tmu_get_temp,
>  	.change_mode = imx91_tmu_change_mode,
>  	.set_trips = imx91_tmu_set_trips,
> --
> 2.55.0
>
>

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

* Re: [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops
  2026-08-08 20:23 [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops Christophe JAILLET
  2026-08-10 19:09 ` Frank Li
@ 2026-09-18 10:16 ` Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2026-09-18 10:16 UTC (permalink / raw)
  To: Christophe JAILLET, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam
  Cc: linux-kernel, kernel-janitors, linux-pm, imx, linux-arm-kernel

On 8/8/26 22:23, Christophe JAILLET wrote:
> 'struct thermal_zone_device_ops' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>     text	   data	    bss	    dec	    hex	filename
>     8567	   2144	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o
> 
> After:
> =====
>     text	   data	    bss	    dec	    hex	filename
>     8695	   2016	      0	  10711	   29d7	drivers/thermal/imx91_thermal.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

Applied, thanks


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

end of thread, other threads:[~2026-09-18 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-08 20:23 [PATCH] thermal/drivers/imx9: Constify struct thermal_zone_device_ops Christophe JAILLET
2026-08-10 19:09 ` Frank Li
2026-09-18 10:16 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®