mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 12:11:59 +02:00
power: supply: qti_battery_charger: Handle state only if driver is initialized
There is a chance that battery_chg_state_cb() can get invoked before the battery charger driver finishes initialization. Handle it. Change-Id: If959b00d3055e0194184b5c3992b0c0906d29213 Signed-off-by: Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>
This commit is contained in:
parent
b57cad08fb
commit
8e42f9587d
|
|
@ -494,6 +494,11 @@ static void battery_chg_state_cb(void *priv, enum pmic_glink_state state)
|
|||
|
||||
pr_debug("state: %d\n", state);
|
||||
|
||||
if (!bcdev->initialized) {
|
||||
pr_warn("Driver not initialized, pmic_glink state %d\n", state);
|
||||
return;
|
||||
}
|
||||
|
||||
atomic_set(&bcdev->state, state);
|
||||
if (state == PMIC_GLINK_STATE_UP)
|
||||
schedule_work(&bcdev->subsys_up_work);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user