* [PATCH] thermal/core: Check get_temp ops is present when registering a tz
@ 2023-12-13 12:13 Daniel Lezcano
2023-12-13 12:46 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Lezcano @ 2023-12-13 12:13 UTC (permalink / raw)
To: rafael, daniel.lezcano
Cc: Zhang Rui, Lukasz Luba, open list:THERMAL, open list
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.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/thermal/thermal_core.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 625ba07cbe2f..964f26e517f4 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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 *t
return 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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] thermal/core: Check get_temp ops is present when registering a tz
2023-12-13 12:13 [PATCH] thermal/core: Check get_temp ops is present when registering a tz Daniel Lezcano
@ 2023-12-13 12:46 ` Rafael J. Wysocki
2023-12-13 13:31 ` Daniel Lezcano
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-12-13 12:46 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, Zhang Rui, Lukasz Luba, open list:THERMAL, open list
On Wed, Dec 13, 2023 at 1:13 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> 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.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Looks good. Do you want me to pick it up?
> ---
> drivers/thermal/thermal_core.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 625ba07cbe2f..964f26e517f4 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -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 *t
> return 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] thermal/core: Check get_temp ops is present when registering a tz
2023-12-13 12:46 ` Rafael J. Wysocki
@ 2023-12-13 13:31 ` Daniel Lezcano
2023-12-13 13:37 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Lezcano @ 2023-12-13 13:31 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Zhang Rui, Lukasz Luba, open list:THERMAL, open list
On 13/12/2023 13:46, Rafael J. Wysocki wrote:
> On Wed, Dec 13, 2023 at 1:13 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> 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.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>
> Looks good. Do you want me to pick it up?
Yes please
Thanks
--
<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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal/core: Check get_temp ops is present when registering a tz
2023-12-13 13:31 ` Daniel Lezcano
@ 2023-12-13 13:37 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-12-13 13:37 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Rafael J. Wysocki, Zhang Rui, Lukasz Luba, open list:THERMAL, open list
On Wed, Dec 13, 2023 at 2:31 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 13/12/2023 13:46, Rafael J. Wysocki wrote:
> > On Wed, Dec 13, 2023 at 1:13 PM Daniel Lezcano
> > <daniel.lezcano@linaro.org> wrote:
> >>
> >> 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.
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >
> > Looks good. Do you want me to pick it up?
>
> Yes please
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-13 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13 12:13 [PATCH] thermal/core: Check get_temp ops is present when registering a tz Daniel Lezcano
2023-12-13 12:46 ` Rafael J. Wysocki
2023-12-13 13:31 ` Daniel Lezcano
2023-12-13 13:37 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®