Skip to content

Commit 767e684

Browse files
linuswsre
authored andcommitted
power: supply: ab8500: Defer thermal zone probe
The call thermal_zone_get_zone_by_name() used to return the thermal zone right away, but recent refactorings in the thermal core has changed this so the thermal zone used by the battery is probed later, and the call returns -ENODEV. This was always quite fragile. If we get -ENODEV, then return a -EPROBE_DEFER and try again later. Cc: phone-devel@vger.kernel.org Fixes: 2b0e7ac ("power: supply: ab8500: Integrate thermal zone") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent f9be5cb commit 767e684

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/power/supply/ab8500_btemp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
725725
/* Get thermal zone and ADC */
726726
di->tz = thermal_zone_get_zone_by_name("battery-thermal");
727727
if (IS_ERR(di->tz)) {
728-
return dev_err_probe(dev, PTR_ERR(di->tz),
728+
ret = PTR_ERR(di->tz);
729+
/*
730+
* This usually just means we are probing before the thermal
731+
* zone, so just defer.
732+
*/
733+
if (ret == -ENODEV)
734+
ret = -EPROBE_DEFER;
735+
return dev_err_probe(dev, ret,
729736
"failed to get battery thermal zone\n");
730737
}
731738
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");

0 commit comments

Comments
 (0)