drm/ttm: use a static ttm_bo_global instance
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 <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

committed by
Alex Deucher

parent
56b3d20413
commit
62b53b37e4
@@ -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
|
||||
|
Reference in New Issue
Block a user