All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: Allow restarting a transfer
@ 2020-09-29  1:24 Thinh Nguyen
  2020-09-29  6:35 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Thinh Nguyen @ 2020-09-29  1:24 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, linux-usb; +Cc: John Youn

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)
 		return ret;
 
 	starting = !(dep->flags & DWC3_EP_TRANSFER_STARTED);

base-commit: 53139e6fa28fa0faa0a40476b033e13da25751fe
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: Allow restarting a transfer
  2020-09-29  1:24 [PATCH] usb: dwc3: gadget: Allow restarting a transfer Thinh Nguyen
@ 2020-09-29  6:35 ` Felipe Balbi
  2020-09-29  7:19   ` Thinh Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2020-09-29  6:35 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, linux-usb; +Cc: John Youn

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

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

-- 
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: Allow restarting a transfer
  2020-09-29  6:35 ` Felipe Balbi
@ 2020-09-29  7:19   ` Thinh Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thinh Nguyen @ 2020-09-29  7:19 UTC (permalink / raw)
  To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb; +Cc: John Youn

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-29  7:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29  1:24 [PATCH] usb: dwc3: gadget: Allow restarting a transfer Thinh Nguyen
2020-09-29  6:35 ` Felipe Balbi
2020-09-29  7:19   ` Thinh Nguyen

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.