thermal/intel_powerclamp: add const to thermal_cooling_device_ops structure
PATCH 1/1 thermal/intel_powerclamp: 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/thermal/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel_powerclamp.c +1 -1
@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, }/* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = { .get_max_state = powerclamp_get_max_state, .get_cur_state = powerclamp_get_cur_state, .set_cur_state = powerclamp_set_cur_state,
Signature · 1 line
2.7.4
Zhang Rui
reviewerQuoted 6 lines · Bhumika Goyal
Declare
thermal_cooling_device_opsstructure as const as it is only passed
as an argument to the functionthermal_cooling_device_registerand this
argument is of type const. So, declare the structure as const.
I checked the source and the code is written in this way as well in some other drivers, why not fix them altogether?
thanks,
rui
Quoted 21 lines
Signed-off-by Bhumika Goyal <[email protected]>---
drivers/thermal/intel_powerclamp.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel_powerclamp.c +0
-0@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, }
/* bind to generic thermal layer as cooling device*/drivers/thermal/intel_powerclamp.c +1
-1-static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops
powerclamp_cooling_ops= {
.get_max_state =powerclamp_get_max_state, .get_cur_state =powerclamp_get_cur_state, .set_cur_state =powerclamp_set_cur_state,
Quoted 10 lines · Zhang Rui
Quoted 6 lines · Bhumika Goyal
Declare
thermal_cooling_device_opsstructure as const as it is only passed
as an argument to the functionthermal_cooling_device_registerand this
argument is of type const. So, declare the structure as const.I checked the source and the code is written in this way as well in some other drivers, why not fix them altogether?
Hey,
I have already sent the patches for the drivers requiring this change. Some of them got applied as well.
Thanks,
Bhumika
Quoted 23 lines
thanks,
ruiQuoted 21 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/thermal/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel_powerclamp.c +1
-1@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, }/* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = { .get_max_state = powerclamp_get_max_state,.get_cur_state =
powerclamp_get_cur_state,
.set_cur_state =powerclamp_set_cur_state,
Zhang Rui
reviewerQuoted 13 lines · Bhumika Goyal
Quoted 11 lines · Zhang Rui
Quoted 9 lines · Bhumika Goyal
Declare
thermal_cooling_device_opsstructure as const as it is only
passed
as an argument to the functionthermal_cooling_device_registerand
this
argument is of type const. So, declare the structure as const.
Quoted 8 lines
Quoted 3 lines
I checked the source and the code is written in this way as well in some other drivers, why not fix them altogether?
Hey,
I have already sent the patches for the drivers requiring this change.
Some of them got applied as well.
I mean the other drivers that use thermal_cooling_device_ops.
Surely I can applied this patch, but still it would be nice if you can check the other places that defines thermal_cooling_device_ops and fix all of them in one time. :)
thanks,
rui
Quoted 30 lines
Thanks,
BhumikaQuoted 26 lines
thanks,
ruiQuoted 23 lines
Signed-off-by Bhumika Goyal <[email protected]>---
drivers/thermal/intel_powerclamp.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel_powerclamp.c +1
-1@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, } /* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = {.get_max_state =
powerclamp_get_max_state,
.get_cur_state =powerclamp_get_cur_state,
.set_cur_state =powerclamp_set_cur_state,
Quoted 17 lines · Zhang Rui
Quoted 16 lines · Bhumika Goyal
Quoted 14 lines · Zhang Rui
Quoted 9 lines · Bhumika Goyal
Declare
thermal_cooling_device_opsstructure as const as it is only
passed
as an argument to the functionthermal_cooling_device_registerand
this
argument is of type const. So, declare the structure as const.I checked the source and the code is written in this way as well in some other drivers, why not fix them altogether?
Quoted 8 lines
Quoted 5 lines
Hey,
I have already sent the patches for the drivers requiring this change.
Some of them got applied as well.I mean the other drivers that use
thermal_cooling_device_ops.
Actually, I also meant the same but maybe I wasn't clear enough :)
Quoted 4 lines
Surely I can applied this patch, but still it would be nice if you can check the other places that defines
thermal_cooling_device_opsand fix all of them in one time. :)
I checked again and there remains only one file in power/supply where thermal_cooling_device_ops can be made const. I will submit a patch for it but I think I will have to create a separate patch because the maintainers are different.
All other places are either already const or I have submitted patches for them or cannot be made const.
Thanks,
Bhumika
Quoted 32 lines
thanks,
ruiQuoted 30 lines
Thanks,
BhumikaQuoted 26 lines
thanks,
ruiQuoted 23 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/thermal/intel_powerclamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel_powerclamp.c +1
-1@@ -659,7 +659,7 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, } /* bind to generic thermal layer as cooling device*/ -static struct thermal_cooling_device_ops powerclamp_cooling_ops = { +static const struct thermal_cooling_device_ops powerclamp_cooling_ops = {.get_max_state =
powerclamp_get_max_state,
.get_cur_state =powerclamp_get_cur_state,
.set_cur_state =powerclamp_set_cur_state,
Zhang Rui
reviewerQuoted 50 lines · Bhumika Goyal
Quoted 25 lines · Zhang Rui
Quoted 23 lines · Bhumika Goyal
Quoted 20 lines · Zhang Rui
Quoted 13 lines · Bhumika Goyal
Declare
thermal_cooling_device_opsstructure as const as it is
only
passed
as an argument to the functionthermal_cooling_device_register
and
this
argument is of type const. So, declare the structure as const.I checked the source and the code is written in this way as well in
some other drivers, why not fix them altogether?Quoted 7 lines
Quoted 5 lines
Hey,
I have already sent the patches for the drivers requiring this change.
Some of them got applied as well.I mean the other drivers that use
thermal_cooling_device_ops.Actually, I also meant the same but maybe I wasn't clear enough :)
Quoted 7 lines
Surely I can applied this patch, but still it would be nice if you can
check the other places that definesthermal_cooling_device_opsand fix
all of them in one time. :)I checked again and there remains only one file in power/supply where
thermal_cooling_device_opscan be made const. I will submit a patch for it but I think I will have to create a separate patch because the maintainers are different.
All other places are either already const
Quoted 2 lines
or I have submitted patches
for them
am I in the loop of the patches? because I was not aware of those changes.
thanks,
rui
Quoted 43 lines
or cannot be made const.
Thanks,
BhumikaQuoted 38 lines
thanks,
ruiQuoted 35 lines
Thanks,
BhumikaQuoted 30 lines
thanks,
ruiQuoted 26 lines
Signed-off-by Bhumika Goyal <[email protected]>---
drivers/thermal/intel_powerclamp.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/intel_powerclamp.c +0
-0@@ -659,7 +659,7 @@ static intpowerclamp_set_cur_state(struct
thermal_cooling_device*cdev,
}/* bind to generic thermal layer as cooling device*/ -static struct
thermal_cooling_device_opspowerclamp_cooling_ops
= {
+static const structthermal_cooling_device_opspowerclamp_cooling_ops= {
.get_max_state =powerclamp_get_max_state, .get_cur_state =powerclamp_get_cur_state, .set_cur_state =powerclamp_set_cur_state,