diff options
Diffstat (limited to 'drivers/gpu/drm/bochs/bochs_mm.c')
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_mm.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c index e6ccf7fa92d4..0980411e41bf 100644 --- a/drivers/gpu/drm/bochs/bochs_mm.c +++ b/drivers/gpu/drm/bochs/bochs_mm.c | |||
@@ -16,61 +16,6 @@ static inline struct bochs_device *bochs_bdev(struct ttm_bo_device *bd) | |||
16 | return container_of(bd, struct bochs_device, ttm.bdev); | 16 | return container_of(bd, struct bochs_device, ttm.bdev); |
17 | } | 17 | } |
18 | 18 | ||
19 | static int bochs_ttm_mem_global_init(struct drm_global_reference *ref) | ||
20 | { | ||
21 | return ttm_mem_global_init(ref->object); | ||
22 | } | ||
23 | |||
24 | static void bochs_ttm_mem_global_release(struct drm_global_reference *ref) | ||
25 | { | ||
26 | ttm_mem_global_release(ref->object); | ||
27 | } | ||
28 | |||
29 | static int bochs_ttm_global_init(struct bochs_device *bochs) | ||
30 | { | ||
31 | struct drm_global_reference *global_ref; | ||
32 | int r; | ||
33 | |||
34 | global_ref = &bochs->ttm.mem_global_ref; | ||
35 | global_ref->global_type = DRM_GLOBAL_TTM_MEM; | ||
36 | global_ref->size = sizeof(struct ttm_mem_global); | ||
37 | global_ref->init = &bochs_ttm_mem_global_init; | ||
38 | global_ref->release = &bochs_ttm_mem_global_release; | ||
39 | r = drm_global_item_ref(global_ref); | ||
40 | if (r != 0) { | ||
41 | DRM_ERROR("Failed setting up TTM memory accounting " | ||
42 | "subsystem.\n"); | ||
43 | return r; | ||
44 | } | ||
45 | |||
46 | bochs->ttm.bo_global_ref.mem_glob = | ||
47 | bochs->ttm.mem_global_ref.object; | ||
48 | global_ref = &bochs->ttm.bo_global_ref.ref; | ||
49 | global_ref->global_type = DRM_GLOBAL_TTM_BO; | ||
50 | global_ref->size = sizeof(struct ttm_bo_global); | ||
51 | global_ref->init = &ttm_bo_global_init; | ||
52 | global_ref->release = &ttm_bo_global_release; | ||
53 | r = drm_global_item_ref(global_ref); | ||
54 | if (r != 0) { | ||
55 | DRM_ERROR("Failed setting up TTM BO subsystem.\n"); | ||
56 | drm_global_item_unref(&bochs->ttm.mem_global_ref); | ||
57 | return r; | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static void bochs_ttm_global_release(struct bochs_device *bochs) | ||
64 | { | ||
65 | if (bochs->ttm.mem_global_ref.release == NULL) | ||
66 | return; | ||
67 | |||
68 | drm_global_item_unref(&bochs->ttm.bo_global_ref.ref); | ||
69 | drm_global_item_unref(&bochs->ttm.mem_global_ref); | ||
70 | bochs->ttm.mem_global_ref.release = NULL; | ||
71 | } | ||
72 | |||
73 | |||
74 | static void bochs_bo_ttm_destroy(struct ttm_buffer_object *tbo) | 19 | static void bochs_bo_ttm_destroy(struct ttm_buffer_object *tbo) |
75 | { | 20 | { |
76 | struct bochs_bo *bo; | 21 | struct bochs_bo *bo; |
@@ -208,12 +153,7 @@ int bochs_mm_init(struct bochs_device *bochs) | |||
208 | struct ttm_bo_device *bdev = &bochs->ttm.bdev; | 153 | struct ttm_bo_device *bdev = &bochs->ttm.bdev; |
209 | int ret; | 154 | int ret; |
210 | 155 | ||
211 | ret = bochs_ttm_global_init(bochs); | ||
212 | if (ret) | ||
213 | return ret; | ||
214 | |||
215 | ret = ttm_bo_device_init(&bochs->ttm.bdev, | 156 | ret = ttm_bo_device_init(&bochs->ttm.bdev, |
216 | bochs->ttm.bo_global_ref.ref.object, | ||
217 | &bochs_bo_driver, | 157 | &bochs_bo_driver, |
218 | bochs->dev->anon_inode->i_mapping, | 158 | bochs->dev->anon_inode->i_mapping, |
219 | DRM_FILE_PAGE_OFFSET, | 159 | DRM_FILE_PAGE_OFFSET, |
@@ -240,7 +180,6 @@ void bochs_mm_fini(struct bochs_device *bochs) | |||
240 | return; | 180 | return; |
241 | 181 | ||
242 | ttm_bo_device_release(&bochs->ttm.bdev); | 182 | ttm_bo_device_release(&bochs->ttm.bdev); |
243 | bochs_ttm_global_release(bochs); | ||
244 | bochs->ttm.initialized = false; | 183 | bochs->ttm.initialized = false; |
245 | } | 184 | } |
246 | 185 | ||