Re: [RFC PATCH] USB: core: urb: add new transfer flag URB_FREE_COHERENT

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

 




On 05.06.22 15:45, Vincent MAILHOL wrote:
>
> This is how I see things:
>   * In the open() function, the driver will do the coherent allocation
> for its transfer_buffers, fill those into URBs and add all the URBs in
> an anchor.
>   * During runtime, the driver will keep recycling the same URBs (no
> need to kill URB nor to usb_free_coherent() the transfer_buffer).
Yes.
>   * Finally, in the close() function, the driver has to kill the URBs
> and usb_free_coherent() the transfer_buffers. As far as I understand,
> no helper functions allow us to do all that, thus requiring the driver
> to iterate through the anchor to manually usb_free_coherent() the
> transfer buffer.
Yes. But you cannot nicely solve that with a flag as you proposed. You
would need to use a helper function.
> So, the intent of this patch is to provide a method to both kill the
> URBs and usb_free_coherent() the transfer buffer at once. The
Well, you don't directly. Your patch frees the buffer together with the URB.
That has some uses, but you still would need to iterate over the URBs
Yes, there is a helper for that, but then you cover one and only one
use case, that is, you leave no way to free the buffers without
at the same time discrading the URBs.

You can do that, but it strikes me as unelegant.

    Regards
        Oliver





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

  Powered by Linux