usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails
Subsystems (2)
PATCH 1/1 usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails
Currently while UDC suspends, u_ether attempts to remote wakeup the host if there are any pending transfers. However, if remote wakeup fails, the UDC remains suspended but the is_suspend flag is not set. And since is_suspend flag isn't set, the subsequent eth_start_xmit() would queue USB requests to suspended UDC.
To fix this, bail out from gether_suspend() only if remote wakeup operation is successful.
--- drivers/usb/gadget/function/u_ether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/u_ether.c +2 -2
@@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link)* There is a transfer in progress. So we trigger a remote * wakeup to inform the host. */ -ether_wakeup_host (dev->port_usb); -return ; +if (!ether_wakeup_host (dev->port_usb)) +return ; }spin_lock_irqsave (&dev->lock, flags); link->is_suspend = true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerQuoted 21 lines · Prashanth K
Currently while UDC suspends,
u_etherattempts to remote wakeup the host if there are any pending transfers. However, if remote wakeup fails, the UDC remains suspended but theis_suspendflag is not set. And sinceis_suspendflag isn't set, the subsequenteth_start_xmit()would queue USB requests to suspended UDC.To fix this, bail out from
gether_suspend()only if remote wakeup operation is successful.Fixes 0a1af6dfa077 ("usb: gadget: f_ecm: Add suspend/resume and remote wakeup support")Signed-off-by Prashanth K <[email protected]>--- drivers/usb/gadget/function/u_ether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/function/u_ether.c +0
-0
drivers/usb/gadget/function/u_ether.c void gether_suspend(struct gether *link) · line 1056
Quoted 7 lines
drivers/usb/gadget/function/u_ether.c +2
-2@@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link)* There is a transfer in progress. So we trigger a remote * wakeup to inform the host. */ -ether_wakeup_host (dev->port_usb); -return ; +if (!ether_wakeup_host (dev->port_usb)) +return ;
What about the other place in the driver where this function is called but the return value is ignored?
thanks,
greg k-h
Quoted 33 lines · Greg Kroah-Hartman
Quoted 21 lines · Prashanth K
Currently while UDC suspends,
u_etherattempts to remote wakeup the host if there are any pending transfers. However, if remote wakeup fails, the UDC remains suspended but theis_suspendflag is not set. And sinceis_suspendflag isn't set, the subsequenteth_start_xmit()would queue USB requests to suspended UDC.To fix this, bail out from
gether_suspend()only if remote wakeup operation is successful.Fixes 0a1af6dfa077 ("usb: gadget: f_ecm: Add suspend/resume and remote wakeup support")Signed-off-by Prashanth K <[email protected]>--- drivers/usb/gadget/function/u_ether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/function/u_ether.c +0
-0drivers/usb/gadget/function/u_ether.c void gether_suspend(struct gether *link) · line 1056
Quoted 7 lines
drivers/usb/gadget/function/u_ether.c +2
-2@@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link)* There is a transfer in progress. So we trigger a remote * wakeup to inform the host. */ -ether_wakeup_host (dev->port_usb); -return ; +if (!ether_wakeup_host (dev->port_usb)) +return ;What about the other place in the driver where this function is called but the return value is ignored?
Quoted 3 lines
thanks,
greg k-h
Other than above one, eth_start_xmit() tries to remote wakeup host when we have some data to send from n/w layer. In that case we try to wakeup host and directly return NETDEV_TX_BUSY to caller. If remote wakeup succeeds, then resume() would call netif_start_queue() which again lets n/w layer to queue skb. Hence we don't have to check for ret of ether_wakeup_host() in that case.
Regards,
Prashanth K