Store a pointer to the device instead of the PCI device in the DMA pool

implementation in the LinuxKPI. This avoids use of container_of().

No functional change.

Discussed with:		kib @
Sponsored by:		Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-04-30 09:26:11 +00:00
parent 0af5d6f7d9
commit 5a637529ed
2 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ void linux_dma_pool_free(struct dma_pool *pool, void *vaddr,
dma_addr_t dma_addr);
struct dma_pool {
struct pci_dev *pool_pdev;
struct device *pool_device;
uma_zone_t pool_zone;
struct mtx pool_dma_lock;
bus_dma_tag_t pool_dmat;

View File

@ -701,7 +701,7 @@ dma_pool_obj_import(void *arg, void **store, int count, int domain __unused,
struct linux_dma_obj *obj;
int error, i;
priv = pool->pool_pdev->dev.dma_priv;
priv = pool->pool_device->dma_priv;
for (i = 0; i < count; i++) {
obj = uma_zalloc(linux_dma_obj_zone, flags);
if (obj == NULL)
@ -728,7 +728,7 @@ dma_pool_obj_release(void *arg, void **store, int count)
struct linux_dma_obj *obj;
int i;
priv = pool->pool_pdev->dev.dma_priv;
priv = pool->pool_device->dma_priv;
for (i = 0; i < count; i++) {
obj = store[i];
bus_dmamem_free(pool->pool_dmat, obj->vaddr, obj->dmamap);
@ -746,7 +746,7 @@ linux_dma_pool_create(char *name, struct device *dev, size_t size,
priv = dev->dma_priv;
pool = kzalloc(sizeof(*pool), GFP_KERNEL);
pool->pool_pdev = to_pci_dev(dev);
pool->pool_device = dev;
pool->pool_entry_size = size;
if (bus_dma_tag_create(bus_get_dma_tag(dev->bsddev),