summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_auth.c4
-rw-r--r--linux-core/drm_hashtab.h2
-rw-r--r--linux-core/drm_sman.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c
index 2857c943..b6a3cba3 100644
--- a/linux-core/drm_auth.c
+++ b/linux-core/drm_auth.c
@@ -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);
diff --git a/linux-core/drm_hashtab.h b/linux-core/drm_hashtab.h
index 7f457e74..580a02ed 100644
--- a/linux-core/drm_hashtab.h
+++ b/linux-core/drm_hashtab.h
@@ -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;
diff --git a/linux-core/drm_sman.c b/linux-core/drm_sman.c
index 96557932..a03c9f55 100644
--- a/linux-core/drm_sman.c
+++ b/linux-core/drm_sman.c
@@ -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);
}