aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_hashtab.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-07-11 20:26:44 -0400
committerDave Airlie <airlied@linux.ie>2007-07-11 20:26:44 -0400
commite0be428e6645f2891fab6be92d1b0e9aad972e7d (patch)
treecf071bb45d7f043da0ed28bde707daa3a6dce4f5 /drivers/char/drm/drm_hashtab.c
parent9698b4dba42eb758ad98012c21e5fbdb372fe2d9 (diff)
drm: detypedef the hashtab and more of sman
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_hashtab.c')
-rw-r--r--drivers/char/drm/drm_hashtab.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/char/drm/drm_hashtab.c b/drivers/char/drm/drm_hashtab.c
index 31acb621dcce..3ad319070704 100644
--- a/drivers/char/drm/drm_hashtab.c
+++ b/drivers/char/drm/drm_hashtab.c
@@ -36,7 +36,7 @@
36#include "drm_hashtab.h" 36#include "drm_hashtab.h"
37#include <linux/hash.h> 37#include <linux/hash.h>
38 38
39int drm_ht_create(drm_open_hash_t *ht, unsigned int order) 39int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
40{ 40{
41 unsigned int i; 41 unsigned int i;
42 42
@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
63 return 0; 63 return 0;
64} 64}
65 65
66void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) 66void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
67{ 67{
68 drm_hash_item_t *entry; 68 struct drm_hash_item *entry;
69 struct hlist_head *h_list; 69 struct hlist_head *h_list;
70 struct hlist_node *list; 70 struct hlist_node *list;
71 unsigned int hashed_key; 71 unsigned int hashed_key;
@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key)
75 DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); 75 DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
76 h_list = &ht->table[hashed_key]; 76 h_list = &ht->table[hashed_key];
77 hlist_for_each(list, h_list) { 77 hlist_for_each(list, h_list) {
78 entry = hlist_entry(list, drm_hash_item_t, head); 78 entry = hlist_entry(list, struct drm_hash_item, head);
79 DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); 79 DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
80 } 80 }
81} 81}
82 82
83static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, 83static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
84 unsigned long key) 84 unsigned long key)
85{ 85{
86 drm_hash_item_t *entry; 86 struct drm_hash_item *entry;
87 struct hlist_head *h_list; 87 struct hlist_head *h_list;
88 struct hlist_node *list; 88 struct hlist_node *list;
89 unsigned int hashed_key; 89 unsigned int hashed_key;
@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
91 hashed_key = hash_long(key, ht->order); 91 hashed_key = hash_long(key, ht->order);
92 h_list = &ht->table[hashed_key]; 92 h_list = &ht->table[hashed_key];
93 hlist_for_each(list, h_list) { 93 hlist_for_each(list, h_list) {
94 entry = hlist_entry(list, drm_hash_item_t, head); 94 entry = hlist_entry(list, struct drm_hash_item, head);
95 if (entry->key == key) 95 if (entry->key == key)
96 return list; 96 return list;
97 if (entry->key > key) 97 if (entry->key > key)
@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
101} 101}
102 102
103 103
104int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) 104int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
105{ 105{
106 drm_hash_item_t *entry; 106 struct drm_hash_item *entry;
107 struct hlist_head *h_list; 107 struct hlist_head *h_list;
108 struct hlist_node *list, *parent; 108 struct hlist_node *list, *parent;
109 unsigned int hashed_key; 109 unsigned int hashed_key;
@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
113 h_list = &ht->table[hashed_key]; 113 h_list = &ht->table[hashed_key];
114 parent = NULL; 114 parent = NULL;
115 hlist_for_each(list, h_list) { 115 hlist_for_each(list, h_list) {
116 entry = hlist_entry(list, drm_hash_item_t, head); 116 entry = hlist_entry(list, struct drm_hash_item, head);
117 if (entry->key == key) 117 if (entry->key == key)
118 return -EINVAL; 118 return -EINVAL;
119 if (entry->key > key) 119 if (entry->key > key)
@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
132 * Just insert an item and return any "bits" bit key that hasn't been 132 * Just insert an item and return any "bits" bit key that hasn't been
133 * used before. 133 * used before.
134 */ 134 */
135int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, 135int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
136 unsigned long seed, int bits, int shift, 136 unsigned long seed, int bits, int shift,
137 unsigned long add) 137 unsigned long add)
138{ 138{
@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
156 return 0; 156 return 0;
157} 157}
158 158
159int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, 159int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
160 drm_hash_item_t **item) 160 struct drm_hash_item **item)
161{ 161{
162 struct hlist_node *list; 162 struct hlist_node *list;
163 163
@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
165 if (!list) 165 if (!list)
166 return -EINVAL; 166 return -EINVAL;
167 167
168 *item = hlist_entry(list, drm_hash_item_t, head); 168 *item = hlist_entry(list, struct drm_hash_item, head);
169 return 0; 169 return 0;
170} 170}
171 171
172int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) 172int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key)
173{ 173{
174 struct hlist_node *list; 174 struct hlist_node *list;
175 175
@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
182 return -EINVAL; 182 return -EINVAL;
183} 183}
184 184
185int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item) 185int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
186{ 186{
187 hlist_del_init(&item->head); 187 hlist_del_init(&item->head);
188 ht->fill--; 188 ht->fill--;
189 return 0; 189 return 0;
190} 190}
191 191
192void drm_ht_remove(drm_open_hash_t *ht) 192void drm_ht_remove(struct drm_open_hash *ht)
193{ 193{
194 if (ht->table) { 194 if (ht->table) {
195 if (ht->use_vmalloc) 195 if (ht->use_vmalloc)