Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0be428e authored by Dave Airlie's avatar Dave Airlie
Browse files

drm: detypedef the hashtab and more of sman



Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 9698b4db
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ typedef struct drm_ioctl_desc {

struct drm_magic_entry {
	struct list_head head;
	drm_hash_item_t hash_item;
	struct drm_hash_item hash_item;
	struct drm_file *priv;
	struct drm_magic_entry *next;
};
@@ -481,7 +481,7 @@ struct drm_sigdata {
 */
struct drm_map_list {
	struct list_head head;		/**< list head */
	drm_hash_item_t hash;
	struct drm_hash_item hash;
	struct drm_map *map;			/**< mapping */
	unsigned int user_token;
};
@@ -660,7 +660,7 @@ struct drm_device {
	/** \name Authentication */
	/*@{ */
	struct list_head filelist;
	drm_open_hash_t magiclist;	/**< magic hash table */
	struct drm_open_hash magiclist;	/**< magic hash table */
	struct list_head magicfree;
	/*@} */

@@ -668,7 +668,7 @@ struct drm_device {
	/*@{ */
	struct list_head maplist;	/**< Linked list of 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 */
	/*@{ */
+2 −2
Original line number Diff line number Diff line
@@ -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_magic_entry *pt;
	drm_hash_item_t *hash;
	struct drm_hash_item *hash;

	mutex_lock(&dev->struct_mutex);
	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,
static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
{
	struct drm_magic_entry *pt;
	drm_hash_item_t *hash;
	struct drm_hash_item *hash;

	DRM_DEBUG("%d\n", magic);

+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
	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)
{
	int use_hashed_handle;
+17 −17
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
#include "drm_hashtab.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;

@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
	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_node *list;
	unsigned int hashed_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);
	h_list = &ht->table[hashed_key];
	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);
	}
}

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)
{
	drm_hash_item_t *entry;
	struct drm_hash_item *entry;
	struct hlist_head *h_list;
	struct hlist_node *list;
	unsigned int hashed_key;
@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
	hashed_key = hash_long(key, ht->order);
	h_list = &ht->table[hashed_key];
	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)
			return list;
		if (entry->key > key)
@@ -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_node *list, *parent;
	unsigned int hashed_key;
@@ -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];
	parent = NULL;
	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)
			return -EINVAL;
		if (entry->key > key)
@@ -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 
 * 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 add)
{
@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
	return 0;
}

int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
		     drm_hash_item_t **item)
int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
		     struct drm_hash_item **item)
{
	struct hlist_node *list;

@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
	if (!list)
		return -EINVAL;

	*item = hlist_entry(list, drm_hash_item_t, head);
	*item = hlist_entry(list, struct drm_hash_item, head);
	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;

@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
	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);
	ht->fill--;
	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->use_vmalloc)
+12 −12
Original line number Diff line number Diff line
@@ -37,31 +37,31 @@

#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;
	unsigned long key;
} drm_hash_item_t;
};

typedef struct drm_open_hash{
struct drm_open_hash {
	unsigned int size;
	unsigned int order;
	unsigned int fill;
	struct hlist_head *table;
	int use_vmalloc;
} drm_open_hash_t;
};


extern int drm_ht_create(drm_open_hash_t *ht, unsigned int order);
extern int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item);
extern int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *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 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 int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key);
extern int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item);
extern void drm_ht_remove(drm_open_hash_t *ht);
extern void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
extern void drm_ht_remove(struct drm_open_hash *ht);


#endif
Loading