From owner-svn-src-all@freebsd.org Tue Apr 30 09:26:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5ECA158A53C; Tue, 30 Apr 2019 09:26:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DA5D9598F; Tue, 30 Apr 2019 09:26:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09C8179D0; Tue, 30 Apr 2019 09:26:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3U9QB9E016772; Tue, 30 Apr 2019 09:26:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3U9QBfM016770; Tue, 30 Apr 2019 09:26:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201904300926.x3U9QBfM016770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 30 Apr 2019 09:26:11 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 346956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2DA5D9598F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2019 09:26:13 -0000 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),