s/list_entry/drm_hash_entry/ for "drm_hash_item"s.

main
Thomas Hellstrom 2006-06-06 17:52:03 +00:00
parent 1a9e5bae10
commit 6c7faf5814
3 changed files with 9 additions and 7 deletions

View File

@ -53,7 +53,7 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
down(&dev->struct_sem);
if (!drm_ht_find_item(&dev->magiclist, (unsigned long) magic, &hash)) {
pt = list_entry(hash, drm_magic_entry_t, hash_item);
pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item);
retval = pt->priv;
}
up(&dev->struct_sem);
@ -113,7 +113,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
up(&dev->struct_sem);
return -EINVAL;
}
pt = list_entry(hash, drm_magic_entry_t, hash_item);
pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item);
drm_ht_remove_item(&dev->magiclist, hash);
list_del(&pt->head);
up(&dev->struct_sem);

View File

@ -35,6 +35,8 @@
#ifndef DRM_HASHTAB_H
#define DRM_HASHTAB_H
#define drm_hash_entry(_a1, _a2, _a3) list_entry(_a1, _a2, _a3)
typedef struct drm_hash_item{
struct hlist_node head;
unsigned long key;

View File

@ -172,8 +172,8 @@ static drm_owner_item_t
ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item);
if (!ret) {
return list_entry(owner_hash_item, drm_owner_item_t,
owner_hash);
return drm_hash_entry(owner_hash_item, drm_owner_item_t,
owner_hash);
}
owner_item = drm_calloc(1, sizeof(*owner_item), DRM_MEM_MM);
@ -264,7 +264,7 @@ int drm_sman_free_key(drm_sman_t * sman, unsigned int key)
if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
return -EINVAL;
memblock_item = list_entry(hash_item, drm_memblock_item_t, user_hash);
memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash);
drm_sman_free(memblock_item);
return 0;
}
@ -289,7 +289,7 @@ int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner)
return -1;
}
owner_item = list_entry(hash_item, drm_owner_item_t, owner_hash);
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash);
if (owner_item->mem_blocks.next == &owner_item->mem_blocks) {
drm_sman_remove_owner(sman, owner_item);
return -1;
@ -323,7 +323,7 @@ void drm_sman_owner_cleanup(drm_sman_t * sman, unsigned long owner)
return;
}
owner_item = list_entry(hash_item, drm_owner_item_t, owner_hash);
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash);
drm_sman_do_owner_cleanup(sman, owner_item);
}