diff options
author | Andrzej Pietrasiewicz <andrzej.p@collabora.com> | 2020-06-29 14:29:22 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-06-29 20:26:37 +0200 |
commit | bbcf90c0646ac797700269fa6645a6a46466c79f (patch) | |
tree | d207eaf7f8565905fa7417fd49a1eebac8da61a8 /drivers/power | |
parent | thermal: Use mode helpers in drivers (diff) | |
download | linux-bbcf90c0646ac797700269fa6645a6a46466c79f.tar.xz linux-bbcf90c0646ac797700269fa6645a6a46466c79f.zip |
thermal: Explicitly enable non-changing thermal zone devices
Some thermal zone devices never change their state, so they should be
always enabled.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200629122925.21729-9-andrzej.p@collabora.com
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/power_supply_core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 02b37fe6061c..90e56736d479 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -939,7 +939,7 @@ static struct thermal_zone_device_ops psy_tzd_ops = { static int psy_register_thermal(struct power_supply *psy) { - int i; + int i, ret; if (psy->desc->no_thermal) return 0; @@ -949,7 +949,12 @@ static int psy_register_thermal(struct power_supply *psy) if (psy->desc->properties[i] == POWER_SUPPLY_PROP_TEMP) { psy->tzd = thermal_zone_device_register(psy->desc->name, 0, 0, psy, &psy_tzd_ops, NULL, 0, 0); - return PTR_ERR_OR_ZERO(psy->tzd); + if (IS_ERR(psy->tzd)) + return PTR_ERR(psy->tzd); + ret = thermal_zone_device_enable(psy->tzd); + if (ret) + thermal_zone_device_unregister(psy->tzd); + return ret; } } return 0; |