diff options
Diffstat (limited to 'drivers/gpu/drm/drm_sman.c')
-rw-r--r-- | drivers/gpu/drm/drm_sman.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpu/drm/drm_sman.c b/drivers/gpu/drm/drm_sman.c index 926f146390ce..463aed9403db 100644 --- a/drivers/gpu/drm/drm_sman.c +++ b/drivers/gpu/drm/drm_sman.c | |||
@@ -48,9 +48,7 @@ void drm_sman_takedown(struct drm_sman * sman) | |||
48 | { | 48 | { |
49 | drm_ht_remove(&sman->user_hash_tab); | 49 | drm_ht_remove(&sman->user_hash_tab); |
50 | drm_ht_remove(&sman->owner_hash_tab); | 50 | drm_ht_remove(&sman->owner_hash_tab); |
51 | if (sman->mm) | 51 | kfree(sman->mm); |
52 | drm_free(sman->mm, sman->num_managers * sizeof(*sman->mm), | ||
53 | DRM_MEM_MM); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | EXPORT_SYMBOL(drm_sman_takedown); | 54 | EXPORT_SYMBOL(drm_sman_takedown); |
@@ -61,8 +59,9 @@ drm_sman_init(struct drm_sman * sman, unsigned int num_managers, | |||
61 | { | 59 | { |
62 | int ret = 0; | 60 | int ret = 0; |
63 | 61 | ||
64 | sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm), | 62 | sman->mm = (struct drm_sman_mm *) kcalloc(num_managers, |
65 | DRM_MEM_MM); | 63 | sizeof(*sman->mm), |
64 | GFP_KERNEL); | ||
66 | if (!sman->mm) { | 65 | if (!sman->mm) { |
67 | ret = -ENOMEM; | 66 | ret = -ENOMEM; |
68 | goto out; | 67 | goto out; |
@@ -78,7 +77,7 @@ drm_sman_init(struct drm_sman * sman, unsigned int num_managers, | |||
78 | 77 | ||
79 | drm_ht_remove(&sman->owner_hash_tab); | 78 | drm_ht_remove(&sman->owner_hash_tab); |
80 | out1: | 79 | out1: |
81 | drm_free(sman->mm, num_managers * sizeof(*sman->mm), DRM_MEM_MM); | 80 | kfree(sman->mm); |
82 | out: | 81 | out: |
83 | return ret; | 82 | return ret; |
84 | } | 83 | } |
@@ -110,7 +109,7 @@ static void drm_sman_mm_destroy(void *private) | |||
110 | { | 109 | { |
111 | struct drm_mm *mm = (struct drm_mm *) private; | 110 | struct drm_mm *mm = (struct drm_mm *) private; |
112 | drm_mm_takedown(mm); | 111 | drm_mm_takedown(mm); |
113 | drm_free(mm, sizeof(*mm), DRM_MEM_MM); | 112 | kfree(mm); |
114 | } | 113 | } |
115 | 114 | ||
116 | static unsigned long drm_sman_mm_offset(void *private, void *ref) | 115 | static unsigned long drm_sman_mm_offset(void *private, void *ref) |
@@ -130,7 +129,7 @@ drm_sman_set_range(struct drm_sman * sman, unsigned int manager, | |||
130 | BUG_ON(manager >= sman->num_managers); | 129 | BUG_ON(manager >= sman->num_managers); |
131 | 130 | ||
132 | sman_mm = &sman->mm[manager]; | 131 | sman_mm = &sman->mm[manager]; |
133 | mm = drm_calloc(1, sizeof(*mm), DRM_MEM_MM); | 132 | mm = kzalloc(sizeof(*mm), GFP_KERNEL); |
134 | if (!mm) { | 133 | if (!mm) { |
135 | return -ENOMEM; | 134 | return -ENOMEM; |
136 | } | 135 | } |
@@ -138,7 +137,7 @@ drm_sman_set_range(struct drm_sman * sman, unsigned int manager, | |||
138 | ret = drm_mm_init(mm, start, size); | 137 | ret = drm_mm_init(mm, start, size); |
139 | 138 | ||
140 | if (ret) { | 139 | if (ret) { |
141 | drm_free(mm, sizeof(*mm), DRM_MEM_MM); | 140 | kfree(mm); |
142 | return ret; | 141 | return ret; |
143 | } | 142 | } |
144 | 143 | ||
@@ -176,7 +175,7 @@ static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman, | |||
176 | owner_hash); | 175 | owner_hash); |
177 | } | 176 | } |
178 | 177 | ||
179 | owner_item = drm_calloc(1, sizeof(*owner_item), DRM_MEM_MM); | 178 | owner_item = kzalloc(sizeof(*owner_item), GFP_KERNEL); |
180 | if (!owner_item) | 179 | if (!owner_item) |
181 | goto out; | 180 | goto out; |
182 | 181 | ||
@@ -189,7 +188,7 @@ static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman, | |||
189 | return owner_item; | 188 | return owner_item; |
190 | 189 | ||
191 | out1: | 190 | out1: |
192 | drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); | 191 | kfree(owner_item); |
193 | out: | 192 | out: |
194 | return NULL; | 193 | return NULL; |
195 | } | 194 | } |
@@ -212,7 +211,7 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man | |||
212 | return NULL; | 211 | return NULL; |
213 | } | 212 | } |
214 | 213 | ||
215 | memblock = drm_calloc(1, sizeof(*memblock), DRM_MEM_MM); | 214 | memblock = kzalloc(sizeof(*memblock), GFP_KERNEL); |
216 | 215 | ||
217 | if (!memblock) | 216 | if (!memblock) |
218 | goto out; | 217 | goto out; |
@@ -237,7 +236,7 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man | |||
237 | out2: | 236 | out2: |
238 | drm_ht_remove_item(&sman->user_hash_tab, &memblock->user_hash); | 237 | drm_ht_remove_item(&sman->user_hash_tab, &memblock->user_hash); |
239 | out1: | 238 | out1: |
240 | drm_free(memblock, sizeof(*memblock), DRM_MEM_MM); | 239 | kfree(memblock); |
241 | out: | 240 | out: |
242 | sman_mm->free(sman_mm->private, tmp); | 241 | sman_mm->free(sman_mm->private, tmp); |
243 | 242 | ||
@@ -253,7 +252,7 @@ static void drm_sman_free(struct drm_memblock_item *item) | |||
253 | list_del(&item->owner_list); | 252 | list_del(&item->owner_list); |
254 | drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); | 253 | drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); |
255 | item->mm->free(item->mm->private, item->mm_info); | 254 | item->mm->free(item->mm->private, item->mm_info); |
256 | drm_free(item, sizeof(*item), DRM_MEM_MM); | 255 | kfree(item); |
257 | } | 256 | } |
258 | 257 | ||
259 | int drm_sman_free_key(struct drm_sman *sman, unsigned int key) | 258 | int drm_sman_free_key(struct drm_sman *sman, unsigned int key) |
@@ -277,7 +276,7 @@ static void drm_sman_remove_owner(struct drm_sman *sman, | |||
277 | { | 276 | { |
278 | list_del(&owner_item->sman_list); | 277 | list_del(&owner_item->sman_list); |
279 | drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); | 278 | drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); |
280 | drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); | 279 | kfree(owner_item); |
281 | } | 280 | } |
282 | 281 | ||
283 | int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) | 282 | int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) |