diff options
author | Christian König <christian.koenig@amd.com> | 2018-10-19 13:49:05 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-11-05 14:21:18 -0500 |
commit | 27eb1fa9130a98edd2b321d4dbce5c8b244ee7af (patch) | |
tree | b94c90b1cec5a325161051012797155964ce0331 /drivers/gpu/drm/ttm | |
parent | 7e07834c12b96214e95a473f7b14fc03b20e2e7a (diff) | |
download | linux-27eb1fa9130a98edd2b321d4dbce5c8b244ee7af.tar.gz linux-27eb1fa9130a98edd2b321d4dbce5c8b244ee7af.tar.bz2 linux-27eb1fa9130a98edd2b321d4dbce5c8b244ee7af.zip |
drm/ttm: use a static ttm_mem_global instance
As the name says we only need one global instance of ttm_mem_global.
Drop all the driver initialization and just use a single exported
instance which is initialized during BO global initialization.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_memory.c | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 9edece6510d3..3006050b1720 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1526,18 +1526,22 @@ void ttm_bo_global_release(struct ttm_bo_global *glob) { kobject_del(&glob->kobj); kobject_put(&glob->kobj); + ttm_mem_global_release(&ttm_mem_glob); } EXPORT_SYMBOL(ttm_bo_global_release); -int ttm_bo_global_init(struct ttm_bo_global *glob, - struct ttm_mem_global *mem_glob) +int ttm_bo_global_init(struct ttm_bo_global *glob) { int ret; unsigned i; + ret = ttm_mem_global_init(&ttm_mem_glob); + if (ret) + return ret; + mutex_init(&glob->device_list_mutex); spin_lock_init(&glob->lru_lock); - glob->mem_glob = mem_glob; + glob->mem_glob = &ttm_mem_glob; glob->mem_glob->bo_glob = glob; glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32); diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index 450387c92b63..7704e17c402f 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -41,6 +41,9 @@ #define TTM_MEMORY_ALLOC_RETRIES 4 +struct ttm_mem_global ttm_mem_glob; +EXPORT_SYMBOL(ttm_mem_glob); + struct ttm_mem_zone { struct kobject kobj; struct ttm_mem_global *glob; @@ -464,7 +467,6 @@ out_no_zone: ttm_mem_global_release(glob); return ret; } -EXPORT_SYMBOL(ttm_mem_global_init); void ttm_mem_global_release(struct ttm_mem_global *glob) { @@ -486,7 +488,6 @@ void ttm_mem_global_release(struct ttm_mem_global *glob) kobject_del(&glob->kobj); kobject_put(&glob->kobj); } -EXPORT_SYMBOL(ttm_mem_global_release); static void ttm_check_swapping(struct ttm_mem_global *glob) { |