Re: [PATCH v2 00/26] IB: Optimize DMA mapping

From: Jason Gunthorpe
Date: Tue Jan 17 2017 - 17:28:06 EST


On Tue, Jan 17, 2017 at 10:00:00PM +0000, Bart Van Assche wrote:
> + /*
> + * qib and hfi1 use two sets of DMA operations:
> + * - The DMA operations of the PCIe device for SDMA.
> + * - dma_virt_ops for users of the qib and hfi1 drivers.
> + * The only purpose of @dma_device is to provide a struct device that
> + * provides dma_virt_ops.
> + */
> + struct device dma_device;

Creating a struct device, not calling device_initialize() and then
passing it around it other places is pretty ugly and potentially
dangerous.

Is there some other way?

Can you setup ibdev to be the 'dma device' for the user side?

Jason