Skip to contentSkip to conversation

platform/x86: add const to thermal_cooling_device_ops structures

PATCH In review Bhumika Goyal 2 participants 4 messages Jun 21, 2017

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

cover platform/x86: add const to thermal_cooling_device_ops structures

Declare thermal_cooling_device_ops structures as const.

Bhumika Goyal (2):
acerhdf: add const to thermal_cooling_device_ops structure
intel_menlow: add const to thermal_cooling_device_ops structure

 drivers/platform/x86/acerhdf.c      | 2 +-
 drivers/platform/x86/intel_menlow.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 acerhdf: add const to thermal_cooling_device_ops structure

Declare thermal_cooling_device_ops structure as const as it is only passed as an argument to the function thermal_cooling_device_register and this argument is of type const. So, declare the structure as const.

---
 drivers/platform/x86/acerhdf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +1 -1
index 2acdb0d..ea22591 100644
@@ -557,7 +557,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 }
 
 /* bind fan callbacks to fan device */
-static struct thermal_cooling_device_ops acerhdf_cooling_ops = {
+static const struct thermal_cooling_device_ops acerhdf_cooling_ops = {
 	.get_max_state = acerhdf_get_max_state,
 	.get_cur_state = acerhdf_get_cur_state,
 	.set_cur_state = acerhdf_set_cur_state,
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 intel_menlow: add const to thermal_cooling_device_ops structure

In reply to Bhumika Goyal

Declare thermal_cooling_device_ops structure as const as it is only passed as an argument to the function thermal_cooling_device_register and this argument is of type const. So, declare the structure as const.

---
 drivers/platform/x86/intel_menlow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel_menlow.c +1 -1
index cbe0102..ef9b0af 100644
@@ -142,7 +142,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
 	return 0;
 }
 
-static struct thermal_cooling_device_ops memory_cooling_ops = {
+static const struct thermal_cooling_device_ops memory_cooling_ops = {
 	.get_max_state = memory_get_max_bandwidth,
 	.get_cur_state = memory_get_cur_bandwidth,
 	.set_cur_state = memory_set_cur_bandwidth,
Signature · 1 line
2.7.4
#3 lore raw
In reply to Bhumika Goyal
Quoted 2 lines · Bhumika Goyal

Declare thermal_cooling_device_ops structures as const.

Thanks, applied to testing.

Quoted 12 lines

Bhumika Goyal (2):
acerhdf: add const to thermal_cooling_device_ops structure
intel_menlow: add const to thermal_cooling_device_ops structure

 drivers/platform/x86/acerhdf.c      | 2 +-
 drivers/platform/x86/intel_menlow.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
Signature · 2 lines
Darren Hart
VMware Open Source Technology Center