Skip to content

Commit

Permalink
thermal/core: Check get_temp ops is present when registering a tz
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
dlezcano authored and rafaeljw committed Dec 13, 2023
1 parent bdc22c8 commit 404f62c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/thermal/thermal_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,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;

Expand Down Expand Up @@ -1285,7 +1280,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);
}
Expand Down

0 comments on commit 404f62c

Please sign in to comment.