Date: Tue, 30 Apr 2019 09:26:11 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346956 - in head/sys/compat/linuxkpi/common: include/linux src Message-ID: <201904300926.x3U9QBfM016770@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Apr 30 09:26:11 2019 New Revision: 346956 URL: https://svnweb.freebsd.org/changeset/base/346956 Log: 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 Modified: head/sys/compat/linuxkpi/common/include/linux/dmapool.h head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/dmapool.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/dmapool.h Tue Apr 30 09:10:45 2019 (r346955) +++ head/sys/compat/linuxkpi/common/include/linux/dmapool.h Tue Apr 30 09:26:11 2019 (r346956) @@ -46,7 +46,7 @@ void linux_dma_pool_free(struct dma_pool *pool, void * 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; Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Tue Apr 30 09:10:45 2019 (r346955) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Tue Apr 30 09:26:11 2019 (r346956) @@ -701,7 +701,7 @@ dma_pool_obj_import(void *arg, void **store, int count 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 coun 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, 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),
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904300926.x3U9QBfM016770>