Re: [PATCH] usb: misc: usbtest: fix pattern tests for scatterlists.

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

 



On Mon, May 02, 2016 at 11:39:03AM +0300, Mathias Nyman wrote:
> The current implemenentation restart the sent pattern for each entry in

%s/implemenentation/implementation

> the sg list. The receiving end expects a continuous pattern, and test

The f_sourcesink may not expect that, have you tried it?

> will fail unless scatterilst entries happen to be aligned with the
> pattern
> 
> Fix this by calculating the pattern byte based on total sent size
> instead of just the current sg entry.
> 
> Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/misc/usbtest.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> index 92fdb6e..c78ff95 100644
> --- a/drivers/usb/misc/usbtest.c
> +++ b/drivers/usb/misc/usbtest.c
> @@ -529,6 +529,7 @@ static struct scatterlist *
>  alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
>  {
>  	struct scatterlist	*sg;
> +	unsigned int		n_size = 0;
>  	unsigned		i;
>  	unsigned		size = max;
>  	unsigned		maxpacket =
> @@ -561,7 +562,8 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
>  			break;
>  		case 1:
>  			for (j = 0; j < size; j++)
> -				*buf++ = (u8) ((j % maxpacket) % 63);
> +				*buf++ = (u8) (((j + n_size) % maxpacket) % 63);
> +			n_size += size;
>  			break;
>  		}
>  
> -- 
> 1.9.1
> 
> --
> 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

-- 

Best Regards,
Peter Chen
--
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