37 #include <linux/hash.h>
38 #include <linux/slab.h>
39 #include <linux/export.h>
52 DRM_ERROR(
"Out of memory for hash table\n");
64 unsigned int hashed_key;
67 hashed_key = hash_long(key, ht->
order);
68 DRM_DEBUG(
"Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
69 h_list = &ht->
table[hashed_key];
72 DRM_DEBUG(
"count %d, key: 0x%08lx\n", count++, entry->
key);
82 unsigned int hashed_key;
84 hashed_key = hash_long(key, ht->
order);
85 h_list = &ht->
table[hashed_key];
88 if (entry->
key == key)
102 unsigned int hashed_key;
103 unsigned long key = item->
key;
105 hashed_key = hash_long(key, ht->
order);
106 h_list = &ht->
table[hashed_key];
110 if (entry->
key == key)
112 if (entry->
key > key)
117 hlist_add_after(parent, &item->
head);
119 hlist_add_head(&item->
head, h_list);
130 unsigned long seed,
int bits,
int shift,
134 unsigned long mask = (1 <<
bits) - 1;
135 unsigned long first, unshifted_key;
137 unshifted_key = hash_long(seed, bits);
138 first = unshifted_key;
140 item->
key = (unshifted_key << shift) + add;
143 unshifted_key = (unshifted_key + 1) & mask;
144 }
while(ret && (unshifted_key != first));
147 DRM_ERROR(
"Available key bit space exhausted\n");
159 list = drm_ht_find_key(ht, key);
172 list = drm_ht_find_key(ht, key);
174 hlist_del_init(list);
182 hlist_del_init(&item->
head);