thermal/core: Check get_temp ops is present when registering a tz
PATCH 1/1 thermal/core: Check get_temp ops is present when registering a tz
Initially the check against the get_temp ops in the thermal_zone_device_update() was put in there in order to catch drivers not providing this method.
Instead of checking again and again the function if the ops exists in the update function, let's do the check at registration time, so it is checked one time and for all.
--- drivers/thermal/thermal_core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/thermal/thermal_core.c +1 -6
@@ -437,11 +437,6 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,if (atomic_read (&in_suspend))return ; -if (WARN_ONCE (!tz->ops->get_temp, -"'%s' must not be called without 'get_temp' ops set\n" , - __func__)) -return ; -if (!thermal_zone_device_is_enabled (tz))return ;
@@ -1289,7 +1284,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *treturn ERR_PTR (-EINVAL ); } -if (!ops) { +if (!ops || !ops->get_temp) {pr_err ("Thermal zone device ops not defined\n" );return ERR_PTR (-EINVAL ); }
Signature · 1 line
2.34.1
Rafael J. Wysocki
maintainerQuoted 10 lines · Daniel Lezcano
Initially the check against the
get_tempops in thethermal_zone_device_update()was put in there in order to catch drivers not providing this method.Instead of checking again and again the function if the ops exists in the update function, let's do the check at registration time, so it is checked one time and for all.
Signed-off-by Daniel Lezcano <[email protected]>
Looks good. Do you want me to pick it up?
Quoted 32 lines
--- drivers/thermal/thermal_core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/thermal/thermal_core.c +1
-7@@ -437,11 +437,6 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,if (atomic_read (&in_suspend))return ; -if (WARN_ONCE (!tz->ops->get_temp, -"'%s' must not be called without 'get_temp' ops set\n" , - __func__)) -return ; -if (!thermal_zone_device_is_enabled (tz))return ;@@ -1289,7 +1284,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *treturn ERR_PTR (-EINVAL ); } -if (!ops) { +if (!ops || !ops->get_temp) {pr_err ("Thermal zone device ops not defined\n" );return ERR_PTR (-EINVAL ); } --2.34.1
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines · Daniel Lezcano
Initially the check against the
get_tempops in thethermal_zone_device_update()was put in there in order to catch drivers not providing this method.
Quoted 7 lines
Quoted 5 lines
Instead of checking again and again the function if the ops exists in the update function, let's do the check at registration time, so it is checked one time and for all.
Signed-off-by Daniel Lezcano <[email protected]>Looks good. Do you want me to pick it up?
Yes please
Thanks
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
Quoted 13 lines · Daniel Lezcano
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Daniel Lezcano
Initially the check against the
get_tempops in thethermal_zone_device_update()was put in there in order to catch drivers not providing this method.Instead of checking again and again the function if the ops exists in the update function, let's do the check at registration time, so it is checked one time and for all.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Daniel Lezcano <[email protected]>Looks good. Do you want me to pick it up?
Yes please
Applied, thanks!