Commit e0be428e authored by Dave Airlie's avatar Dave Airlie

drm: detypedef the hashtab and more of sman

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 9698b4db
...@@ -276,7 +276,7 @@ typedef struct drm_ioctl_desc { ...@@ -276,7 +276,7 @@ typedef struct drm_ioctl_desc {
struct drm_magic_entry { struct drm_magic_entry {
struct list_head head; struct list_head head;
drm_hash_item_t hash_item; struct drm_hash_item hash_item;
struct drm_file *priv; struct drm_file *priv;
struct drm_magic_entry *next; struct drm_magic_entry *next;
}; };
...@@ -481,7 +481,7 @@ struct drm_sigdata { ...@@ -481,7 +481,7 @@ struct drm_sigdata {
*/ */
struct drm_map_list { struct drm_map_list {
struct list_head head; /**< list head */ struct list_head head; /**< list head */
drm_hash_item_t hash; struct drm_hash_item hash;
struct drm_map *map; /**< mapping */ struct drm_map *map; /**< mapping */
unsigned int user_token; unsigned int user_token;
}; };
...@@ -660,7 +660,7 @@ struct drm_device { ...@@ -660,7 +660,7 @@ struct drm_device {
/** \name Authentication */ /** \name Authentication */
/*@{ */ /*@{ */
struct list_head filelist; struct list_head filelist;
drm_open_hash_t magiclist; /**< magic hash table */ struct drm_open_hash magiclist; /**< magic hash table */
struct list_head magicfree; struct list_head magicfree;
/*@} */ /*@} */
...@@ -668,7 +668,7 @@ struct drm_device { ...@@ -668,7 +668,7 @@ struct drm_device {
/*@{ */ /*@{ */
struct list_head maplist; /**< Linked list of regions */ struct list_head maplist; /**< Linked list of regions */
int map_count; /**< Number of mappable regions */ int map_count; /**< Number of mappable regions */
drm_open_hash_t map_hash; /**< User token hash table for maps */ struct drm_open_hash map_hash; /**< User token hash table for maps */
/** \name Context handle management */ /** \name Context handle management */
/*@{ */ /*@{ */
......
...@@ -49,7 +49,7 @@ static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic ...@@ -49,7 +49,7 @@ static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic
{ {
struct drm_file *retval = NULL; struct drm_file *retval = NULL;
struct drm_magic_entry *pt; struct drm_magic_entry *pt;
drm_hash_item_t *hash; struct drm_hash_item *hash;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (!drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) { if (!drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) {
...@@ -105,7 +105,7 @@ static int drm_add_magic(struct drm_device * dev, struct drm_file * priv, ...@@ -105,7 +105,7 @@ static int drm_add_magic(struct drm_device * dev, struct drm_file * priv,
static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic) static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
{ {
struct drm_magic_entry *pt; struct drm_magic_entry *pt;
drm_hash_item_t *hash; struct drm_hash_item *hash;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
......
...@@ -64,7 +64,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, ...@@ -64,7 +64,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
return NULL; return NULL;
} }
static int drm_map_handle(struct drm_device *dev, drm_hash_item_t *hash, static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
unsigned long user_token, int hashed_handle) unsigned long user_token, int hashed_handle)
{ {
int use_hashed_handle; int use_hashed_handle;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "drm_hashtab.h" #include "drm_hashtab.h"
#include <linux/hash.h> #include <linux/hash.h>
int drm_ht_create(drm_open_hash_t *ht, unsigned int order) int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
{ {
unsigned int i; unsigned int i;
...@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order) ...@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
return 0; return 0;
} }
void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list; struct hlist_node *list;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) ...@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key)
DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
} }
} }
static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
unsigned long key) unsigned long key)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list; struct hlist_node *list;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, ...@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
hashed_key = hash_long(key, ht->order); hashed_key = hash_long(key, ht->order);
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
if (entry->key == key) if (entry->key == key)
return list; return list;
if (entry->key > key) if (entry->key > key)
...@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, ...@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
} }
int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list, *parent; struct hlist_node *list, *parent;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) ...@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
parent = NULL; parent = NULL;
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
if (entry->key == key) if (entry->key == key)
return -EINVAL; return -EINVAL;
if (entry->key > key) if (entry->key > key)
...@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) ...@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
* Just insert an item and return any "bits" bit key that hasn't been * Just insert an item and return any "bits" bit key that hasn't been
* used before. * used before.
*/ */
int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
unsigned long seed, int bits, int shift, unsigned long seed, int bits, int shift,
unsigned long add) unsigned long add)
{ {
...@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, ...@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
return 0; return 0;
} }
int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
drm_hash_item_t **item) struct drm_hash_item **item)
{ {
struct hlist_node *list; struct hlist_node *list;
...@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, ...@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
if (!list) if (!list)
return -EINVAL; return -EINVAL;
*item = hlist_entry(list, drm_hash_item_t, head); *item = hlist_entry(list, struct drm_hash_item, head);
return 0; return 0;
} }
int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key)
{ {
struct hlist_node *list; struct hlist_node *list;
...@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) ...@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
return -EINVAL; return -EINVAL;
} }
int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item) int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
{ {
hlist_del_init(&item->head); hlist_del_init(&item->head);
ht->fill--; ht->fill--;
return 0; return 0;
} }
void drm_ht_remove(drm_open_hash_t *ht) void drm_ht_remove(struct drm_open_hash *ht)
{ {
if (ht->table) { if (ht->table) {
if (ht->use_vmalloc) if (ht->use_vmalloc)
......
...@@ -37,31 +37,31 @@ ...@@ -37,31 +37,31 @@
#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member) #define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
typedef struct drm_hash_item{ struct drm_hash_item {
struct hlist_node head; struct hlist_node head;
unsigned long key; unsigned long key;
} drm_hash_item_t; };
typedef struct drm_open_hash{ struct drm_open_hash {
unsigned int size; unsigned int size;
unsigned int order; unsigned int order;
unsigned int fill; unsigned int fill;
struct hlist_head *table; struct hlist_head *table;
int use_vmalloc; int use_vmalloc;
} drm_open_hash_t; };
extern int drm_ht_create(drm_open_hash_t *ht, unsigned int order); extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
extern int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item); extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
extern int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
unsigned long seed, int bits, int shift, unsigned long seed, int bits, int shift,
unsigned long add); unsigned long add);
extern int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, drm_hash_item_t **item); extern int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key, struct drm_hash_item **item);
extern void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key); extern void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key); extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item); extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
extern void drm_ht_remove(drm_open_hash_t *ht); extern void drm_ht_remove(struct drm_open_hash *ht);
#endif #endif
......
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
#include "drm_sman.h" #include "drm_sman.h"
typedef struct drm_owner_item { struct drm_owner_item {
drm_hash_item_t owner_hash; struct drm_hash_item owner_hash;
struct list_head sman_list; struct list_head sman_list;
struct list_head mem_blocks; struct list_head mem_blocks;
} drm_owner_item_t; };
void drm_sman_takedown(struct drm_sman * sman) void drm_sman_takedown(struct drm_sman * sman)
{ {
...@@ -163,16 +163,16 @@ drm_sman_set_manager(struct drm_sman * sman, unsigned int manager, ...@@ -163,16 +163,16 @@ drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
} }
EXPORT_SYMBOL(drm_sman_set_manager); EXPORT_SYMBOL(drm_sman_set_manager);
static drm_owner_item_t *drm_sman_get_owner_item(struct drm_sman * sman, static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman,
unsigned long owner) unsigned long owner)
{ {
int ret; int ret;
drm_hash_item_t *owner_hash_item; struct drm_hash_item *owner_hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item);
if (!ret) { if (!ret) {
return drm_hash_entry(owner_hash_item, drm_owner_item_t, return drm_hash_entry(owner_hash_item, struct drm_owner_item,
owner_hash); owner_hash);
} }
...@@ -200,7 +200,7 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man ...@@ -200,7 +200,7 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man
{ {
void *tmp; void *tmp;
struct drm_sman_mm *sman_mm; struct drm_sman_mm *sman_mm;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
struct drm_memblock_item *memblock; struct drm_memblock_item *memblock;
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
...@@ -258,7 +258,7 @@ static void drm_sman_free(struct drm_memblock_item *item) ...@@ -258,7 +258,7 @@ static void drm_sman_free(struct drm_memblock_item *item)
int drm_sman_free_key(struct drm_sman *sman, unsigned int key) int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
struct drm_memblock_item *memblock_item; struct drm_memblock_item *memblock_item;
if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
...@@ -273,7 +273,7 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned int key) ...@@ -273,7 +273,7 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
EXPORT_SYMBOL(drm_sman_free_key); EXPORT_SYMBOL(drm_sman_free_key);
static void drm_sman_remove_owner(struct drm_sman *sman, static void drm_sman_remove_owner(struct drm_sman *sman,
drm_owner_item_t *owner_item) struct drm_owner_item *owner_item)
{ {
list_del(&owner_item->sman_list); list_del(&owner_item->sman_list);
drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash);
...@@ -283,14 +283,14 @@ static void drm_sman_remove_owner(struct drm_sman *sman, ...@@ -283,14 +283,14 @@ static void drm_sman_remove_owner(struct drm_sman *sman,
int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
return -1; return -1;
} }
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { if (owner_item->mem_blocks.next == &owner_item->mem_blocks) {
drm_sman_remove_owner(sman, owner_item); drm_sman_remove_owner(sman, owner_item);
return -1; return -1;
...@@ -302,7 +302,7 @@ int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner) ...@@ -302,7 +302,7 @@ int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_clean); EXPORT_SYMBOL(drm_sman_owner_clean);
static void drm_sman_do_owner_cleanup(struct drm_sman *sman, static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
drm_owner_item_t *owner_item) struct drm_owner_item *owner_item)
{ {
struct drm_memblock_item *entry, *next; struct drm_memblock_item *entry, *next;
...@@ -316,15 +316,15 @@ static void drm_sman_do_owner_cleanup(struct drm_sman *sman, ...@@ -316,15 +316,15 @@ static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner) void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
return; return;
} }
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
drm_sman_do_owner_cleanup(sman, owner_item); drm_sman_do_owner_cleanup(sman, owner_item);
} }
...@@ -332,7 +332,7 @@ EXPORT_SYMBOL(drm_sman_owner_cleanup); ...@@ -332,7 +332,7 @@ EXPORT_SYMBOL(drm_sman_owner_cleanup);
void drm_sman_cleanup(struct drm_sman *sman) void drm_sman_cleanup(struct drm_sman *sman)
{ {
drm_owner_item_t *entry, *next; struct drm_owner_item *entry, *next;
unsigned int i; unsigned int i;
struct drm_sman_mm *sman_mm; struct drm_sman_mm *sman_mm;
......
...@@ -78,7 +78,7 @@ struct drm_sman_mm { ...@@ -78,7 +78,7 @@ struct drm_sman_mm {
struct drm_memblock_item { struct drm_memblock_item {
struct list_head owner_list; struct list_head owner_list;
drm_hash_item_t user_hash; struct drm_hash_item user_hash;
void *mm_info; void *mm_info;
struct drm_sman_mm *mm; struct drm_sman_mm *mm;
struct drm_sman *sman; struct drm_sman *sman;
...@@ -87,8 +87,8 @@ struct drm_memblock_item { ...@@ -87,8 +87,8 @@ struct drm_memblock_item {
struct drm_sman { struct drm_sman {
struct drm_sman_mm *mm; struct drm_sman_mm *mm;
int num_managers; int num_managers;
drm_open_hash_t owner_hash_tab; struct drm_open_hash owner_hash_tab;
drm_open_hash_t user_hash_tab; struct drm_open_hash user_hash_tab;
struct list_head owner_items; struct list_head owner_items;
}; };
......
...@@ -83,7 +83,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, ...@@ -83,7 +83,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
struct drm_device *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
struct drm_map *map = NULL; struct drm_map *map = NULL;
struct drm_map_list *r_list; struct drm_map_list *r_list;
drm_hash_item_t *hash; struct drm_hash_item *hash;
/* /*
* Find the right map * Find the right map
...@@ -549,7 +549,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) ...@@ -549,7 +549,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
struct drm_device *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
struct drm_map *map = NULL; struct drm_map *map = NULL;
unsigned long offset = 0; unsigned long offset = 0;
drm_hash_item_t *hash; struct drm_hash_item *hash;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n", DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
vma->vm_start, vma->vm_end, vma->vm_pgoff); vma->vm_start, vma->vm_end, vma->vm_pgoff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment