Re: [PATCH v2 1/5] usb: gadget: dummy_hcd: emulate sending zlp in packet logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 14 Sep 2015, Igor Kotrasinski wrote:

> currently, when a zlp flag is set and an urb/usb_request
> buffer is filled without a short packet, transfer() leaves
> its status at -EINPROGRESS and does not rescan for short
> packet.
> 
> In a scenario where ep.maxpacket bytes are copied,
> URB_ZERO_PACKET is set, urb buffer is filled and usb_request
> buffer is not, transfer() returns with an urb with
> -EINPROGRESS status, which dummy_hcd treats as incomplete
> transfer.
> 
> Check for zlp and rescan appropriately.
> 
> Signed-off-by: Igor Kotrasinski <i.kotrasinsk@xxxxxxxxxxx>
> ---
>  drivers/usb/gadget/udc/dummy_hcd.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 181112c..59be03e 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -1364,15 +1364,23 @@ top:
>  					req->req.status = 0;
>  			}
>  
> -		/* many requests terminate without a short packet */
> +		/* many requests terminate without a short packet.
> +		 * send a zlp if demanded by flags.
> +		 */

The style we are using now for multi-line comments is like this:

		/*
		 * blah, blah, blah
		 * blah, blah, blah
		 */

I realize that's not how the existing comments look, but we try to
enforce this style for all new comments.

>  		} else {
> -			if (req->req.length == req->req.actual
> -					&& !req->req.zero)
> -				req->req.status = 0;
> -			if (urb->transfer_buffer_length == urb->actual_length
> -					&& !(urb->transfer_flags
> -						& URB_ZERO_PACKET))
> -				*status = 0;
> +			if (req->req.length == req->req.actual) {
> +				if (req->req.zero && to_host)
> +					rescan = 1;
> +				else
> +					req->req.status = 0;
> +			}
> +			if (urb->transfer_buffer_length == urb->actual_length) {
> +				if (urb->transfer_flags & URB_ZERO_PACKET &&
> +				    !to_host)
> +					rescan = 1;
> +				else
> +					*status = 0;
> +			}
>  		}
>  
>  		/* device side completion --> continuable */

Apart from that style issue,

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux