Message ID | 20201013092746.10602-2-peter.chen@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RESEND,1/2] usb: gadget: core: change the comment for usb_gadget_connect | expand |
On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote: > > Current UDC core connects gadget during the loading gadget flow > (udc_bind_to_driver->usb_udc_connect_control), but for > platforms which do not connect gadget if the VBUS is not there, > they call usb_gadget_disconnect, but the gadget is not connected > at this time, notify disconnecton for the gadget driver is meaningless > at this situation. > > Signed-off-by: Peter Chen <peter.chen@nxp.com> > --- > drivers/usb/gadget/udc/core.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > index 215ecbe8b692..8ad4203dea8c 100644 > --- a/drivers/usb/gadget/udc/core.c > +++ b/drivers/usb/gadget/udc/core.c > @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) > goto out; > } > > + if (!gadget->connected) > + goto out; > + > if (gadget->deactivated) { > /* > * If gadget is deactivated we only save new state. > -- > 2.17.1 > A gentle ping. Peter
BR, Peter Chen On Thu, Oct 29, 2020 at 6:45 PM Peter Chen <hzpeterchen@gmail.com> wrote: > > On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote: > > > > Current UDC core connects gadget during the loading gadget flow > > (udc_bind_to_driver->usb_udc_connect_control), but for > > platforms which do not connect gadget if the VBUS is not there, > > they call usb_gadget_disconnect, but the gadget is not connected > > at this time, notify disconnecton for the gadget driver is meaningless > > at this situation. > > > > Signed-off-by: Peter Chen <peter.chen@nxp.com> > > --- > > drivers/usb/gadget/udc/core.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > > index 215ecbe8b692..8ad4203dea8c 100644 > > --- a/drivers/usb/gadget/udc/core.c > > +++ b/drivers/usb/gadget/udc/core.c > > @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) > > goto out; > > } > > > > + if (!gadget->connected) > > + goto out; > > + > > if (gadget->deactivated) { > > /* > > * If gadget is deactivated we only save new state. > > -- > > 2.17.1 > > > > A gentle ping. > ping again. Peter
On Tue, Dec 29, 2020 at 01:56:00PM +0800, Peter Chen wrote: > On Tue, Dec 1, 2020 at 2:45 PM Peter Chen <hzpeterchen@gmail.com> wrote: > > > BR, > > Peter Chen > > > > On Thu, Oct 29, 2020 at 6:45 PM Peter Chen <hzpeterchen@gmail.com> wrote: > > > > > > On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote: > > > > > > > > Current UDC core connects gadget during the loading gadget flow > > > > (udc_bind_to_driver->usb_udc_connect_control), but for > > > > platforms which do not connect gadget if the VBUS is not there, > > > > they call usb_gadget_disconnect, but the gadget is not connected > > > > at this time, notify disconnecton for the gadget driver is meaningless > > > > at this situation. > > > > > > > > Signed-off-by: Peter Chen <peter.chen@nxp.com> > > > > --- > > > > drivers/usb/gadget/udc/core.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/drivers/usb/gadget/udc/core.c > > b/drivers/usb/gadget/udc/core.c > > > > index 215ecbe8b692..8ad4203dea8c 100644 > > > > --- a/drivers/usb/gadget/udc/core.c > > > > +++ b/drivers/usb/gadget/udc/core.c > > > > @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) > > > > goto out; > > > > } > > > > > > > > + if (!gadget->connected) > > > > + goto out; > > > > + > > > > if (gadget->deactivated) { > > > > /* > > > > * If gadget is deactivated we only save new state. > > > > -- > > > > 2.17.1 > > > > > > > > > > A gentle ping. > > > > > > > ping again. > > > > Peter > > > > Greg, would you please help to catch it up? Again, can you please resend? thanks, greg k-h
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 215ecbe8b692..8ad4203dea8c 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) goto out; } + if (!gadget->connected) + goto out; + if (gadget->deactivated) { /* * If gadget is deactivated we only save new state.
Current UDC core connects gadget during the loading gadget flow (udc_bind_to_driver->usb_udc_connect_control), but for platforms which do not connect gadget if the VBUS is not there, they call usb_gadget_disconnect, but the gadget is not connected at this time, notify disconnecton for the gadget driver is meaningless at this situation. Signed-off-by: Peter Chen <peter.chen@nxp.com> --- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+)