Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-buf: move dma-buf symbols into the DMA_BUF module namespace

In order to better track where in the kernel the dma-buf code is used,
put the symbols in the namespace DMA_BUF and modify all users of the
symbols to properly import the namespace to not break the build at the
same time.

Now the output of modinfo shows the use of these symbols, making it
easier to watch for users over time:

$ modinfo drivers/misc/fastrpc.ko | grep import
import_ns: DMA_BUF

Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://lore.kernel.org/r/20211010124628.17691-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+66 -17
+17 -17
drivers/dma-buf/dma-buf.c
··· 610 610 module_put(exp_info->owner); 611 611 return ERR_PTR(ret); 612 612 } 613 - EXPORT_SYMBOL_GPL(dma_buf_export); 613 + EXPORT_SYMBOL_NS_GPL(dma_buf_export, DMA_BUF); 614 614 615 615 /** 616 616 * dma_buf_fd - returns a file descriptor for the given struct dma_buf ··· 634 634 635 635 return fd; 636 636 } 637 - EXPORT_SYMBOL_GPL(dma_buf_fd); 637 + EXPORT_SYMBOL_NS_GPL(dma_buf_fd, DMA_BUF); 638 638 639 639 /** 640 640 * dma_buf_get - returns the struct dma_buf related to an fd ··· 660 660 661 661 return file->private_data; 662 662 } 663 - EXPORT_SYMBOL_GPL(dma_buf_get); 663 + EXPORT_SYMBOL_NS_GPL(dma_buf_get, DMA_BUF); 664 664 665 665 /** 666 666 * dma_buf_put - decreases refcount of the buffer ··· 679 679 680 680 fput(dmabuf->file); 681 681 } 682 - EXPORT_SYMBOL_GPL(dma_buf_put); 682 + EXPORT_SYMBOL_NS_GPL(dma_buf_put, DMA_BUF); 683 683 684 684 static void mangle_sg_table(struct sg_table *sg_table) 685 685 { ··· 810 810 dma_buf_detach(dmabuf, attach); 811 811 return ERR_PTR(ret); 812 812 } 813 - EXPORT_SYMBOL_GPL(dma_buf_dynamic_attach); 813 + EXPORT_SYMBOL_NS_GPL(dma_buf_dynamic_attach, DMA_BUF); 814 814 815 815 /** 816 816 * dma_buf_attach - Wrapper for dma_buf_dynamic_attach ··· 825 825 { 826 826 return dma_buf_dynamic_attach(dmabuf, dev, NULL, NULL); 827 827 } 828 - EXPORT_SYMBOL_GPL(dma_buf_attach); 828 + EXPORT_SYMBOL_NS_GPL(dma_buf_attach, DMA_BUF); 829 829 830 830 static void __unmap_dma_buf(struct dma_buf_attachment *attach, 831 831 struct sg_table *sg_table, ··· 871 871 872 872 kfree(attach); 873 873 } 874 - EXPORT_SYMBOL_GPL(dma_buf_detach); 874 + EXPORT_SYMBOL_NS_GPL(dma_buf_detach, DMA_BUF); 875 875 876 876 /** 877 877 * dma_buf_pin - Lock down the DMA-buf ··· 901 901 902 902 return ret; 903 903 } 904 - EXPORT_SYMBOL_GPL(dma_buf_pin); 904 + EXPORT_SYMBOL_NS_GPL(dma_buf_pin, DMA_BUF); 905 905 906 906 /** 907 907 * dma_buf_unpin - Unpin a DMA-buf ··· 922 922 if (dmabuf->ops->unpin) 923 923 dmabuf->ops->unpin(attach); 924 924 } 925 - EXPORT_SYMBOL_GPL(dma_buf_unpin); 925 + EXPORT_SYMBOL_NS_GPL(dma_buf_unpin, DMA_BUF); 926 926 927 927 /** 928 928 * dma_buf_map_attachment - Returns the scatterlist table of the attachment; ··· 1012 1012 #endif /* CONFIG_DMA_API_DEBUG */ 1013 1013 return sg_table; 1014 1014 } 1015 - EXPORT_SYMBOL_GPL(dma_buf_map_attachment); 1015 + EXPORT_SYMBOL_NS_GPL(dma_buf_map_attachment, DMA_BUF); 1016 1016 1017 1017 /** 1018 1018 * dma_buf_unmap_attachment - unmaps and decreases usecount of the buffer;might ··· 1048 1048 !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) 1049 1049 dma_buf_unpin(attach); 1050 1050 } 1051 - EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment); 1051 + EXPORT_SYMBOL_NS_GPL(dma_buf_unmap_attachment, DMA_BUF); 1052 1052 1053 1053 /** 1054 1054 * dma_buf_move_notify - notify attachments that DMA-buf is moving ··· 1068 1068 if (attach->importer_ops) 1069 1069 attach->importer_ops->move_notify(attach); 1070 1070 } 1071 - EXPORT_SYMBOL_GPL(dma_buf_move_notify); 1071 + EXPORT_SYMBOL_NS_GPL(dma_buf_move_notify, DMA_BUF); 1072 1072 1073 1073 /** 1074 1074 * DOC: cpu access ··· 1212 1212 1213 1213 return ret; 1214 1214 } 1215 - EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access); 1215 + EXPORT_SYMBOL_NS_GPL(dma_buf_begin_cpu_access, DMA_BUF); 1216 1216 1217 1217 /** 1218 1218 * dma_buf_end_cpu_access - Must be called after accessing a dma_buf from the ··· 1240 1240 1241 1241 return ret; 1242 1242 } 1243 - EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access); 1243 + EXPORT_SYMBOL_NS_GPL(dma_buf_end_cpu_access, DMA_BUF); 1244 1244 1245 1245 1246 1246 /** ··· 1282 1282 1283 1283 return dmabuf->ops->mmap(dmabuf, vma); 1284 1284 } 1285 - EXPORT_SYMBOL_GPL(dma_buf_mmap); 1285 + EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF); 1286 1286 1287 1287 /** 1288 1288 * dma_buf_vmap - Create virtual mapping for the buffer object into kernel ··· 1336 1336 mutex_unlock(&dmabuf->lock); 1337 1337 return ret; 1338 1338 } 1339 - EXPORT_SYMBOL_GPL(dma_buf_vmap); 1339 + EXPORT_SYMBOL_NS_GPL(dma_buf_vmap, DMA_BUF); 1340 1340 1341 1341 /** 1342 1342 * dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap. ··· 1360 1360 } 1361 1361 mutex_unlock(&dmabuf->lock); 1362 1362 } 1363 - EXPORT_SYMBOL_GPL(dma_buf_vunmap); 1363 + EXPORT_SYMBOL_NS_GPL(dma_buf_vunmap, DMA_BUF); 1364 1364 1365 1365 #ifdef CONFIG_DEBUG_FS 1366 1366 static int dma_buf_debug_show(struct seq_file *s, void *unused)
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 41 41 #include <linux/swiotlb.h> 42 42 #include <linux/dma-buf.h> 43 43 #include <linux/sizes.h> 44 + #include <linux/module.h> 44 45 45 46 #include <drm/ttm/ttm_bo_api.h> 46 47 #include <drm/ttm/ttm_bo_driver.h> ··· 59 58 #include "amdgpu_atomfirmware.h" 60 59 #include "amdgpu_res_cursor.h" 61 60 #include "bif/bif_4_1_d.h" 61 + 62 + MODULE_IMPORT_NS(DMA_BUF); 62 63 63 64 #define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 64 65
+2
drivers/gpu/drm/armada/armada_gem.c
··· 15 15 #include "armada_gem.h" 16 16 #include "armada_ioctlP.h" 17 17 18 + MODULE_IMPORT_NS(DMA_BUF); 19 + 18 20 static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf) 19 21 { 20 22 struct drm_gem_object *gobj = vmf->vma->vm_private_data;
+3
drivers/gpu/drm/drm_gem_framebuffer_helper.c
··· 6 6 */ 7 7 8 8 #include <linux/slab.h> 9 + #include <linux/module.h> 9 10 10 11 #include <drm/drm_damage_helper.h> 11 12 #include <drm/drm_fb_helper.h> ··· 17 16 #include <drm/drm_modeset_helper.h> 18 17 19 18 #include "drm_internal.h" 19 + 20 + MODULE_IMPORT_NS(DMA_BUF); 20 21 21 22 #define AFBC_HEADER_SIZE 16 22 23 #define AFBC_TH_LAYOUT_ALIGNMENT 8
+3
drivers/gpu/drm/drm_prime.c
··· 29 29 #include <linux/export.h> 30 30 #include <linux/dma-buf.h> 31 31 #include <linux/rbtree.h> 32 + #include <linux/module.h> 32 33 33 34 #include <drm/drm.h> 34 35 #include <drm/drm_drv.h> ··· 39 38 #include <drm/drm_prime.h> 40 39 41 40 #include "drm_internal.h" 41 + 42 + MODULE_IMPORT_NS(DMA_BUF); 42 43 43 44 /** 44 45 * DOC: overview and lifetime rules
+3
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
··· 5 5 6 6 #include <drm/drm_prime.h> 7 7 #include <linux/dma-buf.h> 8 + #include <linux/module.h> 8 9 9 10 #include "etnaviv_drv.h" 10 11 #include "etnaviv_gem.h" 12 + 13 + MODULE_IMPORT_NS(DMA_BUF); 11 14 12 15 static struct lock_class_key etnaviv_prime_lock_class; 13 16
+3
drivers/gpu/drm/exynos/exynos_drm_gem.c
··· 9 9 #include <linux/dma-buf.h> 10 10 #include <linux/pfn_t.h> 11 11 #include <linux/shmem_fs.h> 12 + #include <linux/module.h> 12 13 13 14 #include <drm/drm_prime.h> 14 15 #include <drm/drm_vma_manager.h> ··· 17 16 18 17 #include "exynos_drm_drv.h" 19 18 #include "exynos_drm_gem.h" 19 + 20 + MODULE_IMPORT_NS(DMA_BUF); 20 21 21 22 static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem, bool kvmap) 22 23 {
+3
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
··· 7 7 #include <linux/dma-buf.h> 8 8 #include <linux/highmem.h> 9 9 #include <linux/dma-resv.h> 10 + #include <linux/module.h> 10 11 11 12 #include "i915_drv.h" 12 13 #include "i915_gem_object.h" 13 14 #include "i915_scatterlist.h" 15 + 16 + MODULE_IMPORT_NS(DMA_BUF); 14 17 15 18 I915_SELFTEST_DECLARE(static bool force_different_devices;) 16 19
+2
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
··· 11 11 12 12 #include "omap_drv.h" 13 13 14 + MODULE_IMPORT_NS(DMA_BUF); 15 + 14 16 /* ----------------------------------------------------------------------------- 15 17 * DMABUF Export 16 18 */
+3
drivers/gpu/drm/tegra/gem.c
··· 12 12 13 13 #include <linux/dma-buf.h> 14 14 #include <linux/iommu.h> 15 + #include <linux/module.h> 15 16 16 17 #include <drm/drm_drv.h> 17 18 #include <drm/drm_prime.h> ··· 20 19 21 20 #include "drm.h" 22 21 #include "gem.h" 22 + 23 + MODULE_IMPORT_NS(DMA_BUF); 23 24 24 25 static void tegra_bo_put(struct host1x_bo *bo) 25 26 {
+3
drivers/gpu/drm/vmwgfx/ttm_object.c
··· 48 48 #include <linux/spinlock.h> 49 49 #include <linux/slab.h> 50 50 #include <linux/atomic.h> 51 + #include <linux/module.h> 51 52 #include "ttm_object.h" 53 + 54 + MODULE_IMPORT_NS(DMA_BUF); 52 55 53 56 /** 54 57 * struct ttm_object_file
+3
drivers/infiniband/core/umem_dmabuf.c
··· 6 6 #include <linux/dma-buf.h> 7 7 #include <linux/dma-resv.h> 8 8 #include <linux/dma-mapping.h> 9 + #include <linux/module.h> 9 10 10 11 #include "uverbs.h" 12 + 13 + MODULE_IMPORT_NS(DMA_BUF); 11 14 12 15 int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf) 13 16 {
+1
drivers/media/common/videobuf2/videobuf2-core.c
··· 2978 2978 MODULE_DESCRIPTION("Media buffer core framework"); 2979 2979 MODULE_AUTHOR("Pawel Osciak <pawel@osciak.com>, Marek Szyprowski"); 2980 2980 MODULE_LICENSE("GPL"); 2981 + MODULE_IMPORT_NS(DMA_BUF);
+1
drivers/media/common/videobuf2/videobuf2-dma-contig.c
··· 755 755 MODULE_DESCRIPTION("DMA-contig memory handling routines for videobuf2"); 756 756 MODULE_AUTHOR("Pawel Osciak <pawel@osciak.com>"); 757 757 MODULE_LICENSE("GPL"); 758 + MODULE_IMPORT_NS(DMA_BUF);
+1
drivers/media/common/videobuf2/videobuf2-dma-sg.c
··· 666 666 MODULE_DESCRIPTION("dma scatter/gather memory handling routines for videobuf2"); 667 667 MODULE_AUTHOR("Andrzej Pietrasiewicz"); 668 668 MODULE_LICENSE("GPL"); 669 + MODULE_IMPORT_NS(DMA_BUF);
+1
drivers/media/common/videobuf2/videobuf2-vmalloc.c
··· 444 444 MODULE_DESCRIPTION("vmalloc memory handling routines for videobuf2"); 445 445 MODULE_AUTHOR("Pawel Osciak <pawel@osciak.com>"); 446 446 MODULE_LICENSE("GPL"); 447 + MODULE_IMPORT_NS(DMA_BUF);
+1
drivers/misc/fastrpc.c
··· 1767 1767 module_exit(fastrpc_exit); 1768 1768 1769 1769 MODULE_LICENSE("GPL v2"); 1770 + MODULE_IMPORT_NS(DMA_BUF);
+2
drivers/misc/habanalabs/common/memory.c
··· 13 13 #include <linux/slab.h> 14 14 #include <linux/pci-p2pdma.h> 15 15 16 + MODULE_IMPORT_NS(DMA_BUF); 17 + 16 18 #define HL_MMU_DEBUG 0 17 19 18 20 /* use small pages for supporting non-pow2 (32M/40M/48M) DRAM phys page sizes */
+3
drivers/staging/media/tegra-vde/dmabuf-cache.c
··· 12 12 #include <linux/sched.h> 13 13 #include <linux/slab.h> 14 14 #include <linux/workqueue.h> 15 + #include <linux/module.h> 15 16 16 17 #include "vde.h" 18 + 19 + MODULE_IMPORT_NS(DMA_BUF); 17 20 18 21 struct tegra_vde_cache_entry { 19 22 enum dma_data_direction dma_dir;
+3
drivers/tee/tee_shm.c
··· 10 10 #include <linux/slab.h> 11 11 #include <linux/tee_drv.h> 12 12 #include <linux/uio.h> 13 + #include <linux/module.h> 13 14 #include "tee_private.h" 15 + 16 + MODULE_IMPORT_NS(DMA_BUF); 14 17 15 18 static void release_registered_pages(struct tee_shm *shm) 16 19 {
+1
drivers/virtio/virtio_dma_buf.c
··· 86 86 EXPORT_SYMBOL(virtio_dma_buf_get_uuid); 87 87 88 88 MODULE_LICENSE("GPL"); 89 + MODULE_IMPORT_NS(DMA_BUF);
+3
drivers/xen/gntdev-dmabuf.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/types.h> 16 16 #include <linux/uaccess.h> 17 + #include <linux/module.h> 17 18 18 19 #include <xen/xen.h> 19 20 #include <xen/grant_table.h> 20 21 21 22 #include "gntdev-common.h" 22 23 #include "gntdev-dmabuf.h" 24 + 25 + MODULE_IMPORT_NS(DMA_BUF); 23 26 24 27 #ifndef GRANT_INVALID_REF 25 28 /*
+1
samples/vfio-mdev/mbochs.c
··· 1493 1493 mbochs_class = NULL; 1494 1494 } 1495 1495 1496 + MODULE_IMPORT_NS(DMA_BUF); 1496 1497 module_init(mbochs_dev_init) 1497 1498 module_exit(mbochs_dev_exit)