[PATCH] wifi: iwlwifi: Constify struct thermal_zone_device_ops

Christophe JAILLET <[email protected]>
Newsgroups org.kernel.vger.linux-wireless,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel
Message-ID <a8e9ce13554fdc9d3630e550280209e7e9fed9f0.1786221064.git.christophe.jaillet@wanadoo.fr>
'struct thermal_zone_device_ops' is not modified in these drivers.

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
  32535	   8657	    192	  41384	   a1a8	drivers/net/wireless/intel/iwlwifi/mvm/tt.o
  15212	   2872	    128	  18212	   4724	drivers/net/wireless/intel/iwlwifi/mld/thermal.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  32663	   8529	    192	  41384	   a1a8	drivers/net/wireless/intel/iwlwifi/mvm/tt.o
  15340	   2744	    128	  18212	   4724	drivers/net/wireless/intel/iwlwifi/mld/thermal.o

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile tested only.
---
 drivers/net/wireless/intel/iwlwifi/mld/thermal.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mld/thermal.c b/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
index e445b1d7d4b0..25c99899c8a7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
@@ -234,7 +234,7 @@ static int iwl_mld_tzone_set_trip_temp(struct thermal_zone_device *device,
 	return ret;
 }
 
-static  struct thermal_zone_device_ops tzone_ops = {
+static const struct thermal_zone_device_ops tzone_ops = {
 	.get_temp = iwl_mld_tzone_get_temp,
 	.set_trip_temp = iwl_mld_tzone_set_trip_temp,
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 53bab21ebae2..6db141c2cd45 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -643,7 +643,7 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
 	return iwl_mvm_send_temp_report_ths_cmd(mvm);
 }
 
-static  struct thermal_zone_device_ops tzone_ops = {
+static const struct thermal_zone_device_ops tzone_ops = {
 	.get_temp = iwl_mvm_tzone_get_temp,
 	.set_trip_temp = iwl_mvm_tzone_set_trip_temp,
 };
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.