Re: [PATCH] usb: gadget: file_storage: don't assume wMaxPacketSize to be 512

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

 



On Fri, Apr 1, 2011 at 2:08 PM, Felipe Balbi <balbi@xxxxxx> wrote:
> we shouldn't assume that value because on SuperSpeed, we have
> 1024 as wMaxPacketSize.
>
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>
> this was tested with dummy_hcd and a bunch of dd if of
> transfers with different sizes.
>
> Âdrivers/usb/gadget/file_storage.c | Â Â3 ++-
> Â1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
> index a6eacb5..b3c9f29 100644
> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -1249,6 +1249,7 @@ static int do_read(struct fsg_dev *fsg)
>
> Âstatic int do_write(struct fsg_dev *fsg)
> Â{
> +    struct usb_ep      *ep = fsg->bulk_out;
>    Âstruct fsg_lun     Â*curlun = fsg->curlun;
> Â Â Â Âu32 Â Â Â Â Â Â Â Â Â Â lba;
>    Âstruct fsg_buffhd    *bh;
> @@ -1331,7 +1332,7 @@ static int do_write(struct fsg_dev *fsg)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcurlun->info_valid = 1;
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> Â Â Â Â Â Â Â Â Â Â Â Â}
> - Â Â Â Â Â Â Â Â Â Â Â amount -= (amount & 511);
> + Â Â Â Â Â Â Â Â Â Â Â amount -= (amount & (ep->maxpacket - 1));

IMHO,  amount &= ~(ep->maxpacket - 1)  looks better
--
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