diff mbox series

usb: dwc3: gadget: Allow restarting a transfer

Message ID d2664c6b9cbaa091c1ce7bea25e02989fc7f6272.1601342393.git.Thinh.Nguyen@synopsys.com
State New
Headers show
Series usb: dwc3: gadget: Allow restarting a transfer | expand

Commit Message

Thinh Nguyen Sept. 29, 2020, 1:24 a.m. UTC
For streams, sometime host may reject a stream and the device may need
to reinitiate that stream by stopping and restarting a transfer. In this
case, all the TRBs may have already been prepared. Allow the
__dwc3_gadget_kick_transfer() to go through to reinitiate the stream.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 53139e6fa28fa0faa0a40476b033e13da25751fe

Comments

Felipe Balbi Sept. 29, 2020, 6:35 a.m. UTC | #1
Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:

> For streams, sometime host may reject a stream and the device may need
> to reinitiate that stream by stopping and restarting a transfer. In this
> case, all the TRBs may have already been prepared. Allow the
> __dwc3_gadget_kick_transfer() to go through to reinitiate the stream.
>
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
>  drivers/usb/dwc3/gadget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 82bc075ba97c..c53a22f0d952 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1327,7 +1327,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
>  	u32				cmd;
>  
>  	ret = dwc3_prepare_trbs(dep);
> -	if (ret <= 0)
> +	if (ret < 0)

do you mind adding a comment here stating the detail about ret == 0 and
why we're still continuing with it? This would prevent someone from
reverting this change years down the line.

Thanks
Thinh Nguyen Sept. 29, 2020, 7:19 a.m. UTC | #2
Felipe Balbi wrote:
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:

>

>> For streams, sometime host may reject a stream and the device may need

>> to reinitiate that stream by stopping and restarting a transfer. In this

>> case, all the TRBs may have already been prepared. Allow the

>> __dwc3_gadget_kick_transfer() to go through to reinitiate the stream.

>>

>> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

>> ---

>>  drivers/usb/dwc3/gadget.c | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c

>> index 82bc075ba97c..c53a22f0d952 100644

>> --- a/drivers/usb/dwc3/gadget.c

>> +++ b/drivers/usb/dwc3/gadget.c

>> @@ -1327,7 +1327,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)

>>  	u32				cmd;

>>  

>>  	ret = dwc3_prepare_trbs(dep);

>> -	if (ret <= 0)

>> +	if (ret < 0)

> do you mind adding a comment here stating the detail about ret == 0 and

> why we're still continuing with it? This would prevent someone from

> reverting this change years down the line.

>

> Thanks


Sure. I just resent.

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 82bc075ba97c..c53a22f0d952 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1327,7 +1327,7 @@  static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
 	u32				cmd;
 
 	ret = dwc3_prepare_trbs(dep);
-	if (ret <= 0)
+	if (ret < 0)
 		return ret;
 
 	starting = !(dep->flags & DWC3_EP_TRANSFER_STARTED);