]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
usb: dwc3: gadget: make DWC3_EP_WEDGE do the right thing
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Fri, 30 Sep 2011 07:58:44 +0000 (10:58 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 4 Oct 2011 17:25:53 +0000 (10:25 -0700)
This makes DWC3_EP_WEDGE do the right thing, which is
prevent DWC3_EP_WEDGE from ever being cleared by a
ClearFeature(HALT) command.

[ balbi@ti.com : allowed set_wedge to send SetHalt command
to controller ]

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/dwc3/gadget.c

index fd5d2bd9b7ef30ac467fc7e91f5ea55400c68455..16f2ba614fc0f013f7f3d53b1f056426a3f56e4f 100644 (file)
@@ -894,6 +894,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
                else
                        dep->flags |= DWC3_EP_STALL;
        } else {
+               if (dep->flags & DWC3_EP_WEDGE)
+                       return 0;
+
                ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
                        DWC3_DEPCMD_CLEARSTALL, &params);
                if (ret)
@@ -903,6 +906,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
                else
                        dep->flags &= ~DWC3_EP_STALL;
        }
+
        return ret;
 }
 
@@ -936,7 +940,7 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep)
 
        dep->flags |= DWC3_EP_WEDGE;
 
-       return usb_ep_set_halt(ep);
+       return dwc3_gadget_ep_set_halt(ep, 1);
 }
 
 /* -------------------------------------------------------------------------- */