Message ID | 20230616071715.20960-1-quic_kriskura@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] usb: dwc3: gadget: Propagate core init errors to UDC during pullup | expand |
On Fri, Jun 16, 2023 at 12:47:15PM +0530, Krishna Kurapati wrote: > In scenarios where pullup relies on resume (get sync) to initialize > the controller and set the run stop bit, then core_init is followed by > gadget_resume which will eventually set run stop bit. > > But in cases where the core_init fails, the return value is not sent > back to udc appropriately. So according to UDC the controller has > started but in reality we never set the run stop bit. > > On systems like Android, there are uevents sent to HAL depending on > whether the configfs_bind / configfs_disconnect were invoked. In the > above mentioned scnenario, if the core init fails, the run stop won't > be set and the cable plug-out won't result in generation of any > disconnect event and userspace would never get any uevent regarding > cable plug out and we never call pullup(0) again. Furthermore none of > the next Plug-In/Plug-Out's would be known to configfs. > > Return back the appropriate result to UDC to let the userspace/ > configfs know that the pullup failed so they can take appropriate > action. > > Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded") > Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com> > Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> > --- > drivers/usb/dwc3/gadget.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 578804dc29ca..27cb671e18e3 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -2747,7 +2747,9 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) > ret = pm_runtime_get_sync(dwc->dev); > if (!ret || ret < 0) { > pm_runtime_put(dwc->dev); > - return 0; > + if (ret < 0) > + pm_runtime_set_suspended(dwc->dev); > + return ret; > } > > if (dwc->pullups_connected == is_on) { > -- > 2.40.0 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 578804dc29ca..27cb671e18e3 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2747,7 +2747,9 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) ret = pm_runtime_get_sync(dwc->dev); if (!ret || ret < 0) { pm_runtime_put(dwc->dev); - return 0; + if (ret < 0) + pm_runtime_set_suspended(dwc->dev); + return ret; } if (dwc->pullups_connected == is_on) {