Re: [PATCH 2/2] usb: whci-hcd: support urbs with scatter-gather lists

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

 



Alan Stern wrote:
> > The computation itself looks a little strange.  Exactly what is it 
> trying to accomplish?  Apparently it truncates a transfer length if the 
> value is too large, and arranges that the truncated DMA buffer ends at 
> an address which is evenly divisible by maxpacket.

Yes. Which is just nonsense now that I look at it again.

> Isn't the buffer length more important than the ending address?  In
> other words, wouldn't it be more appropriate to do something like this?
> 
> 			if (std->len + dma_len > QTD_MAX_XFER_SIZE) {
> 				dma_len = ((QTD_MAX_XFER_SIZE - std->len) /
> 					qset->max_packet) * qset->max_packet;
> 				ep = dma_addr + dma_len;
> 			}

We require the total length of the qTD to be a multiple of the max
packet size. So,

    if (std->len + dma_len > QTD_MAX_XFER_SIZE) {
	dma_len = (QTD_MAX_XFER_SIZE / qset->max_packet)
                  * qset->max_packet - std->len;
    }

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
--
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