From 62b53b37e4b1500d4eb4624a44ad861cf8d3cd18 Mon Sep 17 00:00:00 2001 From: Christian König Date: Fri, 19 Oct 2018 15:06:06 +0200 Subject: drm/ttm: use a static ttm_bo_global instance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the name says we only need one global instance of ttm_bo_global. Just use a single exported instance which is save to initialize multiple times. Signed-off-by: Christian König Reviewed-by: Junwei Zhang Signed-off-by: Alex Deucher --- include/drm/ttm/ttm_bo_driver.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'include/drm') diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 9cec8835b88f..26be74939f10 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -398,7 +398,7 @@ struct ttm_bo_driver { * @swap_lru: Lru list of buffer objects used for swapping. */ -struct ttm_bo_global { +extern struct ttm_bo_global { /** * Constant after init. @@ -410,8 +410,9 @@ struct ttm_bo_global { spinlock_t lru_lock; /** - * Protected by device_list_mutex. + * Protected by ttm_global_mutex. */ + unsigned int use_count; struct list_head device_list; /** @@ -423,7 +424,7 @@ struct ttm_bo_global { * Internal protection. */ atomic_t bo_count; -}; +} ttm_bo_glob; #define TTM_NUM_MEM_TYPES 8 @@ -568,8 +569,8 @@ void ttm_bo_mem_put(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem); void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem); -void ttm_bo_global_release(struct ttm_bo_global *glob); -int ttm_bo_global_init(struct ttm_bo_global *glob); +void ttm_bo_global_release(void); +int ttm_bo_global_init(void); int ttm_bo_device_release(struct ttm_bo_device *bdev); @@ -906,7 +907,7 @@ struct ttm_bo_global_ref { */ static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref) { - return ttm_bo_global_init(ref->object); + return ttm_bo_global_init(); } /** @@ -920,7 +921,7 @@ static inline int ttm_bo_global_ref_init(struct drm_global_reference *ref) */ static inline void ttm_bo_global_ref_release(struct drm_global_reference *ref) { - ttm_bo_global_release(ref->object); + ttm_bo_global_release(); } #endif -- cgit v1.2.3