mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops
@ 2025-05-25 12:47 Christophe JAILLET
  2025-05-25 21:20 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-05-25 12:47 UTC (permalink / raw)
  To: Peter Kaestle, Hans de Goede, Ilpo Järvinen
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, platform-driver-x86

'struct thermal_zone_device_ops' could be left unmodified 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.

While at it, also constify a struct thermal_zone_params.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  26422	  12584	    512	  39518	   9a5e	drivers/platform/x86/acerhdf.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  26646	  12360	    512	  39518	   9a5e	drivers/platform/x86/acerhdf.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/platform/x86/acerhdf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 4c3bb68e8fe4..5ce5ad3efe69 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -271,7 +271,7 @@ static const struct bios_settings bios_tbl[] __initconst = {
  * this struct is used to instruct thermal layer to use bang_bang instead of
  * default governor for acerhdf
  */
-static struct thermal_zone_params acerhdf_zone_params = {
+static const struct thermal_zone_params acerhdf_zone_params = {
 	.governor_name = "bang_bang",
 };
 
@@ -426,7 +426,7 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
 }
 
 /* bind callback functions to thermalzone */
-static struct thermal_zone_device_ops acerhdf_dev_ops = {
+static const struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.should_bind = acerhdf_should_bind,
 	.get_temp = acerhdf_get_ec_temp,
 	.change_mode = acerhdf_change_mode,
-- 
2.49.0


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

* Re: [PATCH] thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops
  2025-05-25 12:47 [PATCH] thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops Christophe JAILLET
@ 2025-05-25 21:20 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-05-25 21:20 UTC (permalink / raw)
  To: Peter Kaestle, Hans de Goede, Christophe JAILLET
  Cc: linux-kernel, kernel-janitors, platform-driver-x86

On Sun, 25 May 2025 14:47:35 +0200, Christophe JAILLET wrote:

> 'struct thermal_zone_device_ops' could be left unmodified 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.
> 
> While at it, also constify a struct thermal_zone_params.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops
      commit: f38af24df7426c088a5b09c9228ed2646a79edc4

--
 i.


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

end of thread, other threads:[~2025-05-25 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-25 12:47 [PATCH] thermal/drivers/acerhdf: Constify struct thermal_zone_device_ops Christophe JAILLET
2025-05-25 21:20 ` Ilpo Järvinen

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®