Skip to content

Commit 404f62c

Browse files
dlezcanorafaeljw
authored andcommitted
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. Signed-off-by: Daniel Lezcano <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent bdc22c8 commit 404f62c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,6 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
434434
if (atomic_read(&in_suspend))
435435
return;
436436

437-
if (WARN_ONCE(!tz->ops->get_temp,
438-
"'%s' must not be called without 'get_temp' ops set\n",
439-
__func__))
440-
return;
441-
442437
if (!thermal_zone_device_is_enabled(tz))
443438
return;
444439

@@ -1285,7 +1280,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
12851280
return ERR_PTR(-EINVAL);
12861281
}
12871282

1288-
if (!ops) {
1283+
if (!ops || !ops->get_temp) {
12891284
pr_err("Thermal zone device ops not defined\n");
12901285
return ERR_PTR(-EINVAL);
12911286
}

0 commit comments

Comments
 (0)