From bbcf90c0646ac797700269fa6645a6a46466c79f Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Mon, 29 Jun 2020 14:29:22 +0200 Subject: 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 Reviewed-by: Bartlomiej Zolnierkiewicz Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200629122925.21729-9-andrzej.p@collabora.com --- drivers/power/supply/power_supply_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/power') 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; -- cgit v1.2.3-59-g8ed1b