Move calls to msm_otg_notify_charger after attributes chg_state and chg_type have been set. That way the function can use them and not rely only on the "mA" parameter. Signed-off-by: Damien Riegel <damien.riegel@xxxxxxxxxxxxxxxxxxxx> --- drivers/usb/phy/phy-msm-usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 93d9aaad2994..c1460182bc56 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1392,9 +1392,9 @@ static void msm_otg_sm_work(struct work_struct *w) pm_runtime_put_sync(otg->usb_phy->dev); msm_otg_reset(otg->usb_phy); } - msm_otg_notify_charger(motg, 0); motg->chg_state = USB_CHG_STATE_UNDEFINED; motg->chg_type = USB_INVALID_CHARGER; + msm_otg_notify_charger(motg, 0); } if (otg->state == OTG_STATE_B_IDLE) @@ -1404,10 +1404,10 @@ static void msm_otg_sm_work(struct work_struct *w) dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); if (!test_bit(B_SESS_VLD, &motg->inputs) || !test_bit(ID, &motg->inputs)) { - msm_otg_notify_charger(motg, 0); - msm_otg_start_peripheral(otg->usb_phy, 0); motg->chg_state = USB_CHG_STATE_UNDEFINED; motg->chg_type = USB_INVALID_CHARGER; + msm_otg_notify_charger(motg, 0); + msm_otg_start_peripheral(otg->usb_phy, 0); otg->state = OTG_STATE_B_IDLE; msm_otg_reset(otg->usb_phy); schedule_work(w); -- 2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html