Skip to content

Commit 16b0314

Browse files
committed
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>
1 parent d46e58e commit 16b0314

23 files changed

Lines changed: 66 additions & 17 deletions

File tree

‎drivers/dma-buf/dma-buf.c‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
610610
module_put(exp_info->owner);
611611
return ERR_PTR(ret);
612612
}
613-
EXPORT_SYMBOL_GPL(dma_buf_export);
613+
EXPORT_SYMBOL_NS_GPL(dma_buf_export, DMA_BUF);
614614

615615
/**
616616
* dma_buf_fd - returns a file descriptor for the given struct dma_buf
@@ -634,7 +634,7 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags)
634634

635635
return fd;
636636
}
637-
EXPORT_SYMBOL_GPL(dma_buf_fd);
637+
EXPORT_SYMBOL_NS_GPL(dma_buf_fd, DMA_BUF);
638638

639639
/**
640640
* dma_buf_get - returns the struct dma_buf related to an fd
@@ -660,7 +660,7 @@ struct dma_buf *dma_buf_get(int fd)
660660

661661
return file->private_data;
662662
}
663-
EXPORT_SYMBOL_GPL(dma_buf_get);
663+
EXPORT_SYMBOL_NS_GPL(dma_buf_get, DMA_BUF);
664664

665665
/**
666666
* dma_buf_put - decreases refcount of the buffer
@@ -679,7 +679,7 @@ void dma_buf_put(struct dma_buf *dmabuf)
679679

680680
fput(dmabuf->file);
681681
}
682-
EXPORT_SYMBOL_GPL(dma_buf_put);
682+
EXPORT_SYMBOL_NS_GPL(dma_buf_put, DMA_BUF);
683683

684684
static void mangle_sg_table(struct sg_table *sg_table)
685685
{
@@ -810,7 +810,7 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev,
810810
dma_buf_detach(dmabuf, attach);
811811
return ERR_PTR(ret);
812812
}
813-
EXPORT_SYMBOL_GPL(dma_buf_dynamic_attach);
813+
EXPORT_SYMBOL_NS_GPL(dma_buf_dynamic_attach, DMA_BUF);
814814

815815
/**
816816
* dma_buf_attach - Wrapper for dma_buf_dynamic_attach
@@ -825,7 +825,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
825825
{
826826
return dma_buf_dynamic_attach(dmabuf, dev, NULL, NULL);
827827
}
828-
EXPORT_SYMBOL_GPL(dma_buf_attach);
828+
EXPORT_SYMBOL_NS_GPL(dma_buf_attach, DMA_BUF);
829829

830830
static void __unmap_dma_buf(struct dma_buf_attachment *attach,
831831
struct sg_table *sg_table,
@@ -871,7 +871,7 @@ void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach)
871871

872872
kfree(attach);
873873
}
874-
EXPORT_SYMBOL_GPL(dma_buf_detach);
874+
EXPORT_SYMBOL_NS_GPL(dma_buf_detach, DMA_BUF);
875875

876876
/**
877877
* dma_buf_pin - Lock down the DMA-buf
@@ -901,7 +901,7 @@ int dma_buf_pin(struct dma_buf_attachment *attach)
901901

902902
return ret;
903903
}
904-
EXPORT_SYMBOL_GPL(dma_buf_pin);
904+
EXPORT_SYMBOL_NS_GPL(dma_buf_pin, DMA_BUF);
905905

906906
/**
907907
* dma_buf_unpin - Unpin a DMA-buf
@@ -922,7 +922,7 @@ void dma_buf_unpin(struct dma_buf_attachment *attach)
922922
if (dmabuf->ops->unpin)
923923
dmabuf->ops->unpin(attach);
924924
}
925-
EXPORT_SYMBOL_GPL(dma_buf_unpin);
925+
EXPORT_SYMBOL_NS_GPL(dma_buf_unpin, DMA_BUF);
926926

927927
/**
928928
* dma_buf_map_attachment - Returns the scatterlist table of the attachment;
@@ -1012,7 +1012,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
10121012
#endif /* CONFIG_DMA_API_DEBUG */
10131013
return sg_table;
10141014
}
1015-
EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
1015+
EXPORT_SYMBOL_NS_GPL(dma_buf_map_attachment, DMA_BUF);
10161016

10171017
/**
10181018
* dma_buf_unmap_attachment - unmaps and decreases usecount of the buffer;might
@@ -1048,7 +1048,7 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
10481048
!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY))
10491049
dma_buf_unpin(attach);
10501050
}
1051-
EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment);
1051+
EXPORT_SYMBOL_NS_GPL(dma_buf_unmap_attachment, DMA_BUF);
10521052

10531053
/**
10541054
* dma_buf_move_notify - notify attachments that DMA-buf is moving
@@ -1068,7 +1068,7 @@ void dma_buf_move_notify(struct dma_buf *dmabuf)
10681068
if (attach->importer_ops)
10691069
attach->importer_ops->move_notify(attach);
10701070
}
1071-
EXPORT_SYMBOL_GPL(dma_buf_move_notify);
1071+
EXPORT_SYMBOL_NS_GPL(dma_buf_move_notify, DMA_BUF);
10721072

10731073
/**
10741074
* DOC: cpu access
@@ -1212,7 +1212,7 @@ int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
12121212

12131213
return ret;
12141214
}
1215-
EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access);
1215+
EXPORT_SYMBOL_NS_GPL(dma_buf_begin_cpu_access, DMA_BUF);
12161216

12171217
/**
12181218
* dma_buf_end_cpu_access - Must be called after accessing a dma_buf from the
@@ -1240,7 +1240,7 @@ int dma_buf_end_cpu_access(struct dma_buf *dmabuf,
12401240

12411241
return ret;
12421242
}
1243-
EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access);
1243+
EXPORT_SYMBOL_NS_GPL(dma_buf_end_cpu_access, DMA_BUF);
12441244

12451245

12461246
/**
@@ -1282,7 +1282,7 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
12821282

12831283
return dmabuf->ops->mmap(dmabuf, vma);
12841284
}
1285-
EXPORT_SYMBOL_GPL(dma_buf_mmap);
1285+
EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF);
12861286

12871287
/**
12881288
* dma_buf_vmap - Create virtual mapping for the buffer object into kernel
@@ -1336,7 +1336,7 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
13361336
mutex_unlock(&dmabuf->lock);
13371337
return ret;
13381338
}
1339-
EXPORT_SYMBOL_GPL(dma_buf_vmap);
1339+
EXPORT_SYMBOL_NS_GPL(dma_buf_vmap, DMA_BUF);
13401340

13411341
/**
13421342
* dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap.
@@ -1360,7 +1360,7 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
13601360
}
13611361
mutex_unlock(&dmabuf->lock);
13621362
}
1363-
EXPORT_SYMBOL_GPL(dma_buf_vunmap);
1363+
EXPORT_SYMBOL_NS_GPL(dma_buf_vunmap, DMA_BUF);
13641364

13651365
#ifdef CONFIG_DEBUG_FS
13661366
static int dma_buf_debug_show(struct seq_file *s, void *unused)

‎drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/swiotlb.h>
4242
#include <linux/dma-buf.h>
4343
#include <linux/sizes.h>
44+
#include <linux/module.h>
4445

4546
#include <drm/ttm/ttm_bo_api.h>
4647
#include <drm/ttm/ttm_bo_driver.h>
@@ -59,6 +60,8 @@
5960
#include "amdgpu_res_cursor.h"
6061
#include "bif/bif_4_1_d.h"
6162

63+
MODULE_IMPORT_NS(DMA_BUF);
64+
6265
#define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128
6366

6467
static int amdgpu_ttm_backend_bind(struct ttm_device *bdev,

‎drivers/gpu/drm/armada/armada_gem.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "armada_gem.h"
1616
#include "armada_ioctlP.h"
1717

18+
MODULE_IMPORT_NS(DMA_BUF);
19+
1820
static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
1921
{
2022
struct drm_gem_object *gobj = vmf->vma->vm_private_data;

‎drivers/gpu/drm/drm_gem_framebuffer_helper.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/slab.h>
9+
#include <linux/module.h>
910

1011
#include <drm/drm_damage_helper.h>
1112
#include <drm/drm_fb_helper.h>
@@ -17,6 +18,8 @@
1718

1819
#include "drm_internal.h"
1920

21+
MODULE_IMPORT_NS(DMA_BUF);
22+
2023
#define AFBC_HEADER_SIZE 16
2124
#define AFBC_TH_LAYOUT_ALIGNMENT 8
2225
#define AFBC_HDR_ALIGN 64

‎drivers/gpu/drm/drm_prime.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/export.h>
3030
#include <linux/dma-buf.h>
3131
#include <linux/rbtree.h>
32+
#include <linux/module.h>
3233

3334
#include <drm/drm.h>
3435
#include <drm/drm_drv.h>
@@ -39,6 +40,8 @@
3940

4041
#include "drm_internal.h"
4142

43+
MODULE_IMPORT_NS(DMA_BUF);
44+
4245
/**
4346
* DOC: overview and lifetime rules
4447
*

‎drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55

66
#include <drm/drm_prime.h>
77
#include <linux/dma-buf.h>
8+
#include <linux/module.h>
89

910
#include "etnaviv_drv.h"
1011
#include "etnaviv_gem.h"
1112

13+
MODULE_IMPORT_NS(DMA_BUF);
14+
1215
static struct lock_class_key etnaviv_prime_lock_class;
1316

1417
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj)

‎drivers/gpu/drm/exynos/exynos_drm_gem.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/dma-buf.h>
1010
#include <linux/pfn_t.h>
1111
#include <linux/shmem_fs.h>
12+
#include <linux/module.h>
1213

1314
#include <drm/drm_prime.h>
1415
#include <drm/drm_vma_manager.h>
@@ -17,6 +18,8 @@
1718
#include "exynos_drm_drv.h"
1819
#include "exynos_drm_gem.h"
1920

21+
MODULE_IMPORT_NS(DMA_BUF);
22+
2023
static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem, bool kvmap)
2124
{
2225
struct drm_device *dev = exynos_gem->base.dev;

‎drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
#include <linux/dma-buf.h>
88
#include <linux/highmem.h>
99
#include <linux/dma-resv.h>
10+
#include <linux/module.h>
1011

1112
#include "i915_drv.h"
1213
#include "i915_gem_object.h"
1314
#include "i915_scatterlist.h"
1415

16+
MODULE_IMPORT_NS(DMA_BUF);
17+
1518
I915_SELFTEST_DECLARE(static bool force_different_devices;)
1619

1720
static struct drm_i915_gem_object *dma_buf_to_obj(struct dma_buf *buf)

‎drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "omap_drv.h"
1313

14+
MODULE_IMPORT_NS(DMA_BUF);
15+
1416
/* -----------------------------------------------------------------------------
1517
* DMABUF Export
1618
*/

‎drivers/gpu/drm/tegra/gem.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/dma-buf.h>
1414
#include <linux/iommu.h>
15+
#include <linux/module.h>
1516

1617
#include <drm/drm_drv.h>
1718
#include <drm/drm_prime.h>
@@ -20,6 +21,8 @@
2021
#include "drm.h"
2122
#include "gem.h"
2223

24+
MODULE_IMPORT_NS(DMA_BUF);
25+
2326
static void tegra_bo_put(struct host1x_bo *bo)
2427
{
2528
struct tegra_bo *obj = host1x_to_tegra_bo(bo);

0 commit comments

Comments
 (0)