Re: [PATCH 1/2] USB: Allow HCDs to specifiy their DMA alignment requirements

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

 



On Wed, Sep 1, 2010 at 12:52 PM, Oliver Neukum <oneukum@xxxxxxx> wrote:
> Am Mittwoch, 1. September 2010, 11:41:06 schrieb Ming Lei:
>
>> > +               if (urb->bounce_buffer) {
>> > +                       if (dir == DMA_FROM_DEVICE)
>> > +                               memcpy(urb->transfer_buffer,
>> > +                                       urb->bounce_buffer,
>> > +                                       urb->transfer_buffer_length);
>> > +                       kfree(urb->bounce_buffer);
>>
>>  dma_unmap_single is needed for bounce_buffer.
>
> Good catch.

I don't think there's actually anything wrong here.
The patch format makes it a little confusing but the relevant section
of code with the patch applied is:

        else if (urb->transfer_flags & URB_DMA_MAP_SINGLE) {
                dma_unmap_single(hcd->self.controller,
                                urb->transfer_dma,
                                urb->transfer_buffer_length,
                                dir);
                if (urb->bounce_buffer) {
                        if (dir == DMA_FROM_DEVICE)
                                memcpy(urb->transfer_buffer,
                                        urb->bounce_buffer,
                                        urb->transfer_buffer_length);
                        kfree(urb->bounce_buffer);
                }

So dma_unmap_single() is always called (in the bounce case
urb->transfer_dma is the
mapped version of bouce_buffer).

Regards,

Martin
--
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