Messages in this thread | | | Date | Tue, 28 Feb 2023 01:23:45 +0100 | From | Sebastian Reichel <> | Subject | Re: [RESEND 1/2] power_supply: Register cooling device outside of probe |
| |
Hi,
On Mon, Feb 27, 2023 at 01:46:52PM -0800, Subbaraman Narayanamurthy wrote: > On 6/9/22 3:12 PM, Sebastian Reichel wrote: > > Hi, > > > > On Wed, Jun 01, 2022 at 12:00:53AM +0530, Manaf Meethalavalappu Pallikunhi wrote: > >> Registering the cooling device from the probe can result in the > >> execution of get_property() function before it gets initialized. > >> > >> To avoid this, register the cooling device from a workqueue > >> instead of registering in the probe. > >> > >> Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com> > >> --- > > This removes error handling from the psy_register_cooler() call, so > > it introduces a new potential problem. If power_supply_get_property() > > is called to early -EAGAIN is returned. So can you elaborate the problem > > that you are seeing with the current code? > > > > -- Sebastian > > When the device boots up with all the vendor modules getting loaded, > here is what we're seeing when booting up with 6.1.11 recently. First > log is printed with adding a pr_err() in __power_supply_register(). > > [ 7.008938][ T682] power_supply battery: psy_register_cooler failed, rc=-11 > [ 7.030941][ T682] qti_battery_charger: probe of qcom,battery_charger failed with error -11 > > Here, our downstream qti_battery_charger driver exposes the following > power supply properties POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT and > POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX under a power supply device. > > This is happening because of the following call sequence, > > battery_chg_probe() -> > power_supply_register() -> > psy_register_cooler() -> > thermal_cooling_device_register() -> > cdev->ops->get_max_state() -> > ps_get_max_charge_cntl_limit() -> > power_supply_get_property() > > ends up calling power_supply_get_property() to read CHARGE_CONTROL_LIMIT > property. > > However, it returns -EAGAIN because psy->initialized is set to true > later after psy_register_cooler() succeeds. So, this ends up in a > driver probe failure forever.
This should be solved in 6.3:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/power/supply/power_supply_core.c?id=c85c191694cb1cf290b11059b3d2de8a2732ffd0
-- Sebastian [unhandled content-type:application/pgp-signature] | |