aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_sman.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_sman.c')
-rw-r--r--drivers/char/drm/drm_sman.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/drivers/char/drm/drm_sman.c b/drivers/char/drm/drm_sman.c
index 8e4bfbd89632..5a075f070c6a 100644
--- a/drivers/char/drm/drm_sman.c
+++ b/drivers/char/drm/drm_sman.c
@@ -44,7 +44,7 @@ typedef struct drm_owner_item {
44 struct list_head mem_blocks; 44 struct list_head mem_blocks;
45} drm_owner_item_t; 45} drm_owner_item_t;
46 46
47void drm_sman_takedown(drm_sman_t * sman) 47void 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);
@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
56EXPORT_SYMBOL(drm_sman_takedown); 56EXPORT_SYMBOL(drm_sman_takedown);
57 57
58int 58int
59drm_sman_init(drm_sman_t * sman, unsigned int num_managers, 59drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
60 unsigned int user_order, unsigned int owner_order) 60 unsigned int user_order, unsigned int owner_order)
61{ 61{
62 int ret = 0; 62 int ret = 0;
63 63
64 sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm), 64 sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm),
65 DRM_MEM_MM); 65 DRM_MEM_MM);
66 if (!sman->mm) { 66 if (!sman->mm) {
67 ret = -ENOMEM; 67 ret = -ENOMEM;
@@ -120,10 +120,10 @@ static unsigned long drm_sman_mm_offset(void *private, void *ref)
120} 120}
121 121
122int 122int
123drm_sman_set_range(drm_sman_t * sman, unsigned int manager, 123drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size) 124 unsigned long start, unsigned long size)
125{ 125{
126 drm_sman_mm_t *sman_mm; 126 struct drm_sman_mm *sman_mm;
127 struct drm_mm *mm; 127 struct drm_mm *mm;
128 int ret; 128 int ret;
129 129
@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
153EXPORT_SYMBOL(drm_sman_set_range); 153EXPORT_SYMBOL(drm_sman_set_range);
154 154
155int 155int
156drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, 156drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
157 drm_sman_mm_t * allocator) 157 struct drm_sman_mm * allocator)
158{ 158{
159 BUG_ON(manager >= sman->num_managers); 159 BUG_ON(manager >= sman->num_managers);
160 sman->mm[manager] = *allocator; 160 sman->mm[manager] = *allocator;
@@ -163,7 +163,7 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
163} 163}
164EXPORT_SYMBOL(drm_sman_set_manager); 164EXPORT_SYMBOL(drm_sman_set_manager);
165 165
166static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, 166static drm_owner_item_t *drm_sman_get_owner_item(struct drm_sman * sman,
167 unsigned long owner) 167 unsigned long owner)
168{ 168{
169 int ret; 169 int ret;
@@ -194,14 +194,14 @@ out:
194 return NULL; 194 return NULL;
195} 195}
196 196
197drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, 197struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager,
198 unsigned long size, unsigned alignment, 198 unsigned long size, unsigned alignment,
199 unsigned long owner) 199 unsigned long owner)
200{ 200{
201 void *tmp; 201 void *tmp;
202 drm_sman_mm_t *sman_mm; 202 struct drm_sman_mm *sman_mm;
203 drm_owner_item_t *owner_item; 203 drm_owner_item_t *owner_item;
204 drm_memblock_item_t *memblock; 204 struct drm_memblock_item *memblock;
205 205
206 BUG_ON(manager >= sman->num_managers); 206 BUG_ON(manager >= sman->num_managers);
207 207
@@ -246,9 +246,9 @@ out:
246 246
247EXPORT_SYMBOL(drm_sman_alloc); 247EXPORT_SYMBOL(drm_sman_alloc);
248 248
249static void drm_sman_free(drm_memblock_item_t *item) 249static void drm_sman_free(struct drm_memblock_item *item)
250{ 250{
251 drm_sman_t *sman = item->sman; 251 struct drm_sman *sman = item->sman;
252 252
253 list_del(&item->owner_list); 253 list_del(&item->owner_list);
254 drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); 254 drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash);
@@ -256,22 +256,23 @@ static void drm_sman_free(drm_memblock_item_t *item)
256 drm_free(item, sizeof(*item), DRM_MEM_MM); 256 drm_free(item, sizeof(*item), DRM_MEM_MM);
257} 257}
258 258
259int drm_sman_free_key(drm_sman_t *sman, unsigned int key) 259int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
260{ 260{
261 drm_hash_item_t *hash_item; 261 drm_hash_item_t *hash_item;
262 drm_memblock_item_t *memblock_item; 262 struct drm_memblock_item *memblock_item;
263 263
264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) 264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
265 return -EINVAL; 265 return -EINVAL;
266 266
267 memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash); 267 memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item,
268 user_hash);
268 drm_sman_free(memblock_item); 269 drm_sman_free(memblock_item);
269 return 0; 270 return 0;
270} 271}
271 272
272EXPORT_SYMBOL(drm_sman_free_key); 273EXPORT_SYMBOL(drm_sman_free_key);
273 274
274static void drm_sman_remove_owner(drm_sman_t *sman, 275static void drm_sman_remove_owner(struct drm_sman *sman,
275 drm_owner_item_t *owner_item) 276 drm_owner_item_t *owner_item)
276{ 277{
277 list_del(&owner_item->sman_list); 278 list_del(&owner_item->sman_list);
@@ -279,7 +280,7 @@ static void drm_sman_remove_owner(drm_sman_t *sman,
279 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); 280 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM);
280} 281}
281 282
282int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) 283int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
283{ 284{
284 285
285 drm_hash_item_t *hash_item; 286 drm_hash_item_t *hash_item;
@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
300 301
301EXPORT_SYMBOL(drm_sman_owner_clean); 302EXPORT_SYMBOL(drm_sman_owner_clean);
302 303
303static void drm_sman_do_owner_cleanup(drm_sman_t *sman, 304static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
304 drm_owner_item_t *owner_item) 305 drm_owner_item_t *owner_item)
305{ 306{
306 drm_memblock_item_t *entry, *next; 307 struct drm_memblock_item *entry, *next;
307 308
308 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, 309 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
309 owner_list) { 310 owner_list) {
@@ -312,7 +313,7 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
312 drm_sman_remove_owner(sman, owner_item); 313 drm_sman_remove_owner(sman, owner_item);
313} 314}
314 315
315void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) 316void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner)
316{ 317{
317 318
318 drm_hash_item_t *hash_item; 319 drm_hash_item_t *hash_item;
@@ -329,11 +330,11 @@ void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner)
329 330
330EXPORT_SYMBOL(drm_sman_owner_cleanup); 331EXPORT_SYMBOL(drm_sman_owner_cleanup);
331 332
332void drm_sman_cleanup(drm_sman_t *sman) 333void drm_sman_cleanup(struct drm_sman *sman)
333{ 334{
334 drm_owner_item_t *entry, *next; 335 drm_owner_item_t *entry, *next;
335 unsigned int i; 336 unsigned int i;
336 drm_sman_mm_t *sman_mm; 337 struct drm_sman_mm *sman_mm;
337 338
338 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) { 339 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
339 drm_sman_do_owner_cleanup(sman, entry); 340 drm_sman_do_owner_cleanup(sman, entry);