Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3548d6a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: phy-msm-usb: Avoid race b/w sm_work and set_suspend"

parents 45c0408f 23bafa2f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -786,6 +786,9 @@ static int msm_otg_set_suspend(struct usb_phy *phy, int suspend)
	if (aca_enabled())
		return 0;

	pr_debug("%s(%d) in %s state\n", __func__, suspend,
				usb_otg_state_string(phy->state));

	/*
	 * UDC and HCD call usb_phy_set_suspend() to enter/exit LPM
	 * during bus suspend/resume.  Update the relevant state
@@ -801,8 +804,13 @@ static int msm_otg_set_suspend(struct usb_phy *phy, int suspend)
		case OTG_STATE_A_HOST:
			pr_debug("host bus suspend\n");
			clear_bit(A_BUS_REQ, &motg->inputs);
			if (!atomic_read(&motg->in_lpm))
			if (!atomic_read(&motg->in_lpm)) {
				queue_work(system_nrt_wq, &motg->sm_work);
				/* Flush sm_work to avoid it race with
				 * subsequent calls of set_suspend.
				 */
				flush_work(&motg->sm_work);
			}
			break;
		case OTG_STATE_B_PERIPHERAL:
			pr_debug("peripheral bus suspend\n");