Skip to contentSkip to conversation

thermal: thermal_mmio: Constify static struct thermal_mmio_ops

PATCH Applied Rikard Falkeborn 5 participants 5 messages Sep 21, 2021 – Oct 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: thermal_mmio: Constify static struct thermal_mmio_ops

The only usage of thermal_mmio_ops is to pass its address to devm_thermal_zone_of_sensor_register(), which has a pointer to const struct thermal_zone_of_device_ops as argument. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/thermal/thermal_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_mmio.c +1 -1
index ded1dd0d4ef7..360b0dfdc3b0 100644
@@ -34,7 +34,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp)
 	return 0;
 }
 
-static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+static const struct thermal_zone_of_device_ops thermal_mmio_ops = {
 	.get_temp = thermal_mmio_get_temperature,
 };
 
Signature · 1 line
2.33.0
maintainer Acked-by on v1 1/1
#1 lore raw

The only usage of thermal_mmio_ops is to pass its address to

Quoted 5 lines

devm_thermal_zone_of_sensor_register(), which has a pointer to const struct thermal_zone_of_device_ops as argument. Make it const to allow the compiler to put it in read-only memory.

Quoted 20 lines
---
  drivers/thermal/thermal_mmio.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_mmio.c +1 -2
index ded1dd0d4ef7..360b0dfdc3b0 100644
@@ -34,7 +34,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp)
         return 0;
  }
 
-static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+static const struct thermal_zone_of_device_ops thermal_mmio_ops = {
         .get_temp = thermal_mmio_get_temperature,
  };
 
--

2.33.0

#2 lore raw
In reply to Rikard Falkeborn
Quoted 16 lines · Rikard Falkeborn

The only usage of thermal_mmio_ops is to pass its address to devm_thermal_zone_of_sensor_register(), which has a pointer to const struct thermal_zone_of_device_ops as argument. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/thermal/thermal_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_mmio.c +0 -0
index ded1dd0d4ef7..360b0dfdc3b0 100644

drivers/thermal/thermal_mmio.c static int thermal_mmio_get_temperature(void *private, int *temp)

Quoted 9 lines
drivers/thermal/thermal_mmio.c +1 -2
@@ -34,7 +34,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp)
        return 0;
 }
 
-static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+static const struct thermal_zone_of_device_ops thermal_mmio_ops = {
        .get_temp = thermal_mmio_get_temperature,
 };
 
--

I'm not sure what happened to this patch.

Daniel, are you going to pick it up?

#3 lore raw
Quoted 26 lines · Rafael J. Wysocki
Quoted 24 lines · Rikard Falkeborn

The only usage of thermal_mmio_ops is to pass its address to devm_thermal_zone_of_sensor_register(), which has a pointer to const struct thermal_zone_of_device_ops as argument. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/thermal/thermal_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_mmio.c +1 -1
index ded1dd0d4ef7..360b0dfdc3b0 100644
@@ -34,7 +34,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp)
        return 0;
 }
 
-static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+static const struct thermal_zone_of_device_ops thermal_mmio_ops = {
        .get_temp = thermal_mmio_get_temperature,
 };
 
Quoted 5 lines
Quoted 1 line

--

I'm not sure what happened to this patch.

Daniel, are you going to pick it up?

Yes.

I had picked also the intel ones but I'll drop them.

Signature · 5 lines
<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
#4 lore raw

[thermal: thermal/next] thermal/drivers/thermal_mmio: Constify static struct thermal_mmio_ops

In reply to Rikard Falkeborn
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     69c560d2eb3cff7ebe876cd224a3dc05852990b5
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//69c560d2eb3cff7ebe876cd224a3dc05852990b5
Author:        Rikard Falkeborn <[email protected]>
AuthorDate:    Mon, 20 Sep 2021 22:38:49 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Thu, 07 Oct 2021 15:18:31 +02:00

thermal/drivers/thermal_mmio: Constify static struct thermal_mmio_ops

The only usage of thermal_mmio_ops is to pass its address to devm_thermal_zone_of_sensor_register(), which has a pointer to const struct thermal_zone_of_device_ops as argument. Make it const to allow the compiler to put it in read-only memory.

---
 drivers/thermal/thermal_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_mmio.c +1 -1
index ded1dd0..360b0df 100644
@@ -34,7 +34,7 @@ static int thermal_mmio_get_temperature(void *private, int *temp)
 	return 0;
 }
 
-static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+static const struct thermal_zone_of_device_ops thermal_mmio_ops = {
 	.get_temp = thermal_mmio_get_temperature,
 };