* [PATCH] usb: dwc3: gadget: add missing wakeup link states
@ 2021-04-23 15:25 Marcel Hamer
2021-04-24 8:08 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Hamer @ 2021-04-23 15:25 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Felipe Balbi, linux-kernel, Marcel Hamer
In dwc3_send_gadget_ep_cmd() a check is performed if the gadget needs
waking up. The following condition is checked before calling the
__dwc3_gadget_wakeup() function:
needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||
dwc->link_state == DWC3_LINK_STATE_U2 ||
dwc->link_state == DWC3_LINK_STATE_U3);
Inside __dwc3_gadget_wakeup() only link_state DWC3_LINK_STATE_U3 is checked
and link state DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 are considered
invalid and generate a warning because of the call to:
dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", ret);
because of ret being -EINVAL.
Signed-off-by: Marcel Hamer <marcel@solidxs.se>
---
drivers/usb/dwc3/gadget.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c7ef218e7a8c..d05a7d630410 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1972,6 +1972,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
switch (link_state) {
case DWC3_LINK_STATE_RESET:
case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */
+ case DWC3_LINK_STATE_U1:
+ case DWC3_LINK_STATE_U2:
case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */
case DWC3_LINK_STATE_RESUME:
break;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: add missing wakeup link states
2021-04-23 15:25 [PATCH] usb: dwc3: gadget: add missing wakeup link states Marcel Hamer
@ 2021-04-24 8:08 ` Felipe Balbi
2021-04-24 18:41 ` Marcel Hamer
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2021-04-24 8:08 UTC (permalink / raw)
To: Marcel Hamer, linux-usb
Cc: Greg Kroah-Hartman, linux-kernel, Marcel Hamer, Thinh Nguyen
[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]
Marcel Hamer <marcel@solidxs.se> writes:
> In dwc3_send_gadget_ep_cmd() a check is performed if the gadget needs
> waking up. The following condition is checked before calling the
> __dwc3_gadget_wakeup() function:
>
> needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||
> dwc->link_state == DWC3_LINK_STATE_U2 ||
> dwc->link_state == DWC3_LINK_STATE_U3);
>
> Inside __dwc3_gadget_wakeup() only link_state DWC3_LINK_STATE_U3 is checked
> and link state DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 are considered
> invalid and generate a warning because of the call to:
>
> dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", ret);
>
> because of ret being -EINVAL.
>
> Signed-off-by: Marcel Hamer <marcel@solidxs.se>
> ---
> drivers/usb/dwc3/gadget.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index c7ef218e7a8c..d05a7d630410 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1972,6 +1972,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
> switch (link_state) {
> case DWC3_LINK_STATE_RESET:
> case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */
> + case DWC3_LINK_STATE_U1:
> + case DWC3_LINK_STATE_U2:
I think this was fixed recently by Thinh.
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=c560e76319a94a3b9285bc426c609903408e4826
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: add missing wakeup link states
2021-04-24 8:08 ` Felipe Balbi
@ 2021-04-24 18:41 ` Marcel Hamer
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Hamer @ 2021-04-24 18:41 UTC (permalink / raw)
To: Felipe Balbi
Cc: Marcel Hamer, linux-usb, Greg Kroah-Hartman, linux-kernel, Thinh Nguyen
On Sat, Apr 24, 2021 at 11:08:07AM +0300, Felipe Balbi wrote:
> Marcel Hamer <marcel@solidxs.se> writes:
>
> > In dwc3_send_gadget_ep_cmd() a check is performed if the gadget needs
> > waking up. The following condition is checked before calling the
> > __dwc3_gadget_wakeup() function:
> >
> > needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||
> > dwc->link_state == DWC3_LINK_STATE_U2 ||
> > dwc->link_state == DWC3_LINK_STATE_U3);
> >
> > Inside __dwc3_gadget_wakeup() only link_state DWC3_LINK_STATE_U3 is checked
> > and link state DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 are considered
> > invalid and generate a warning because of the call to:
> >
> > dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", ret);
> >
> > because of ret being -EINVAL.
> >
> > Signed-off-by: Marcel Hamer <marcel@solidxs.se>
> > ---
> > drivers/usb/dwc3/gadget.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index c7ef218e7a8c..d05a7d630410 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -1972,6 +1972,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
> > switch (link_state) {
> > case DWC3_LINK_STATE_RESET:
> > case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */
> > + case DWC3_LINK_STATE_U1:
> > + case DWC3_LINK_STATE_U2:
>
> I think this was fixed recently by Thinh.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=c560e76319a94a3b9285bc426c609903408e4826
>
> --
> balbi
Great, I missed that. Thank you for clarifying this.
Kind regards,
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-24 18:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 15:25 [PATCH] usb: dwc3: gadget: add missing wakeup link states Marcel Hamer
2021-04-24 8:08 ` Felipe Balbi
2021-04-24 18:41 ` Marcel Hamer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.