Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755422AbdDNSof (ORCPT ); Fri, 14 Apr 2017 14:44:35 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:60098 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753302AbdDNSo3 (ORCPT ); Fri, 14 Apr 2017 14:44:29 -0400 From: Damien Riegel To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , MyungJoo Ham , Chanwoo Choi , kernel@savoirfairelinux.com, Damien Riegel Subject: [RFC][PATCH 1/3] usb: phy: msm: notify charger after setting charger info Date: Fri, 14 Apr 2017 14:43:28 -0400 Message-Id: <20170414184330.22296-2-damien.riegel@savoirfairelinux.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170414184330.22296-1-damien.riegel@savoirfairelinux.com> References: <20170414184330.22296-1-damien.riegel@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1467 Lines: 39 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 --- 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