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

Commit 95aa4e8d authored by Felipe Balbi's avatar Felipe Balbi
Browse files

usb: dwc3: gadget: hold the lock through set_wedge()'s life



Instead of releasing the lock and calling locked
versions of our set_halt() methods, let's hold
the lock all the way through and call unlocked
versions of those functions.

Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5ad02fb8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1257,15 +1257,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep)
	struct dwc3_ep			*dep = to_dwc3_ep(ep);
	struct dwc3			*dwc = dep->dwc;
	unsigned long			flags;
	int				ret;

	spin_lock_irqsave(&dwc->lock, flags);
	dep->flags |= DWC3_EP_WEDGE;
	spin_unlock_irqrestore(&dwc->lock, flags);

	if (dep->number == 0 || dep->number == 1)
		return dwc3_gadget_ep0_set_halt(ep, 1);
		ret = __dwc3_gadget_ep0_set_halt(ep, 1);
	else
		return dwc3_gadget_ep_set_halt(ep, 1);
		ret = __dwc3_gadget_ep_set_halt(dep, 1);
	spin_unlock_irqrestore(&dwc->lock, flags);

	return ret;
}

/* -------------------------------------------------------------------------- */