drm: remove hashtab/sman and object typedefs

main
Dave Airlie 2007-07-16 12:48:44 +10:00
parent 21ee6fbfb8
commit 6dce9e0735
15 changed files with 155 additions and 155 deletions

View File

@ -418,7 +418,7 @@ struct drm_file {
struct list_head refd_objects;
struct list_head user_objects;
drm_open_hash_t refd_object_hash[_DRM_NO_REF_TYPES];
struct drm_open_hash refd_object_hash[_DRM_NO_REF_TYPES];
void *driver_priv;
};

View File

@ -505,7 +505,7 @@ void drm_bo_usage_deref_locked(drm_buffer_object_t ** bo)
}
}
static void drm_bo_base_deref_locked(struct drm_file * priv, drm_user_object_t * uo)
static void drm_bo_base_deref_locked(struct drm_file * priv, struct drm_user_object * uo)
{
drm_buffer_object_t *bo =
drm_user_object_entry(uo, drm_buffer_object_t, base);
@ -924,7 +924,7 @@ static int drm_bo_new_mask(drm_buffer_object_t * bo,
drm_buffer_object_t *drm_lookup_buffer_object(struct drm_file * priv,
uint32_t handle, int check_owner)
{
drm_user_object_t *uo;
struct drm_user_object *uo;
drm_buffer_object_t *bo;
uo = drm_lookup_user_object(priv, handle);
@ -1187,7 +1187,7 @@ static int drm_buffer_object_unmap(struct drm_file * priv, uint32_t handle)
{
struct drm_device *dev = priv->head->dev;
drm_buffer_object_t *bo;
drm_ref_object_t *ro;
struct drm_ref_object *ro;
int ret = 0;
mutex_lock(&dev->struct_mutex);
@ -1216,7 +1216,7 @@ static int drm_buffer_object_unmap(struct drm_file * priv, uint32_t handle)
*/
static void drm_buffer_user_object_unmap(struct drm_file * priv,
drm_user_object_t * uo,
struct drm_user_object * uo,
drm_ref_t action)
{
drm_buffer_object_t *bo =
@ -1811,7 +1811,7 @@ int drm_bo_destroy_ioctl(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
struct drm_bo_handle_arg arg;
drm_user_object_t *uo;
struct drm_user_object *uo;
int ret = 0;
if (!dev->bm.initialized) {
@ -1879,7 +1879,7 @@ int drm_bo_reference_ioctl(DRM_IOCTL_ARGS)
struct drm_bo_reference_info_arg arg;
struct drm_bo_handle_arg *req = &arg.d.req;
struct drm_bo_info_rep *rep = &arg.d.rep;
drm_user_object_t *uo;
struct drm_user_object *uo;
int ret;
if (!dev->bm.initialized) {

View File

@ -63,7 +63,7 @@ struct drm_map_list *drm_find_matching_map(struct drm_device *dev, drm_local_map
}
EXPORT_SYMBOL(drm_find_matching_map);
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;

View File

@ -180,7 +180,7 @@ void drm_fence_reference_unlocked(struct drm_fence_object **dst,
}
static void drm_fence_object_destroy(struct drm_file *priv, drm_user_object_t * base)
static void drm_fence_object_destroy(struct drm_file *priv, struct drm_user_object * base)
{
drm_fence_object_t *fence =
drm_user_object_entry(base, drm_fence_object_t, base);
@ -551,7 +551,7 @@ void drm_fence_manager_takedown(struct drm_device * dev)
drm_fence_object_t *drm_lookup_fence_object(struct drm_file * priv, uint32_t handle)
{
struct drm_device *dev = priv->head->dev;
drm_user_object_t *uo;
struct drm_user_object *uo;
drm_fence_object_t *fence;
mutex_lock(&dev->struct_mutex);
@ -619,7 +619,7 @@ int drm_fence_destroy_ioctl(DRM_IOCTL_ARGS)
int ret;
drm_fence_manager_t *fm = &dev->fm;
struct drm_fence_arg arg;
drm_user_object_t *uo;
struct drm_user_object *uo;
ret = 0;
if (!fm->initialized) {
@ -648,7 +648,7 @@ int drm_fence_reference_ioctl(DRM_IOCTL_ARGS)
drm_fence_manager_t *fm = &dev->fm;
struct drm_fence_arg arg;
drm_fence_object_t *fence;
drm_user_object_t *uo;
struct drm_user_object *uo;
unsigned long flags;
ret = 0;

View File

@ -337,8 +337,8 @@ static void drm_object_release(struct file *filp) {
struct drm_file *priv = filp->private_data;
struct list_head *head;
drm_user_object_t *user_object;
drm_ref_object_t *ref_object;
struct drm_user_object *user_object;
struct drm_ref_object *ref_object;
int i;
/*
@ -351,7 +351,7 @@ static void drm_object_release(struct file *filp) {
head = &priv->refd_objects;
while (head->next != head) {
ref_object = list_entry(head->next, drm_ref_object_t, list);
ref_object = list_entry(head->next, struct drm_ref_object, list);
drm_remove_ref_object(priv, ref_object);
head = &priv->refd_objects;
}
@ -362,7 +362,7 @@ static void drm_object_release(struct file *filp) {
head = &priv->user_objects;
while (head->next != head) {
user_object = list_entry(head->next, drm_user_object_t, list);
user_object = list_entry(head->next, struct drm_user_object, list);
drm_remove_user_object(priv, user_object);
head = &priv->user_objects;
}

View File

@ -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)
@ -100,9 +100,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t * ht,
return NULL;
}
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;
@ -112,7 +112,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)
@ -131,7 +131,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)
{
@ -155,8 +155,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;
@ -164,11 +164,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;
@ -181,14 +181,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)

View File

@ -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

View File

@ -30,7 +30,7 @@
#include "drmP.h"
int drm_add_user_object(struct drm_file * priv, drm_user_object_t * item,
int drm_add_user_object(struct drm_file * priv, struct drm_user_object * item,
int shareable)
{
struct drm_device *dev = priv->head->dev;
@ -51,12 +51,12 @@ int drm_add_user_object(struct drm_file * priv, drm_user_object_t * item,
return 0;
}
drm_user_object_t *drm_lookup_user_object(struct drm_file * priv, uint32_t key)
struct drm_user_object *drm_lookup_user_object(struct drm_file * priv, uint32_t key)
{
struct drm_device *dev = priv->head->dev;
drm_hash_item_t *hash;
struct drm_hash_item *hash;
int ret;
drm_user_object_t *item;
struct drm_user_object *item;
DRM_ASSERT_LOCKED(&dev->struct_mutex);
@ -64,10 +64,10 @@ drm_user_object_t *drm_lookup_user_object(struct drm_file * priv, uint32_t key)
if (ret) {
return NULL;
}
item = drm_hash_entry(hash, drm_user_object_t, hash);
item = drm_hash_entry(hash, struct drm_user_object, hash);
if (priv != item->owner) {
drm_open_hash_t *ht = &priv->refd_object_hash[_DRM_REF_USE];
struct drm_open_hash *ht = &priv->refd_object_hash[_DRM_REF_USE];
ret = drm_ht_find_item(ht, (unsigned long)item, &hash);
if (ret) {
DRM_ERROR("Object not registered for usage\n");
@ -77,7 +77,7 @@ drm_user_object_t *drm_lookup_user_object(struct drm_file * priv, uint32_t key)
return item;
}
static void drm_deref_user_object(struct drm_file * priv, drm_user_object_t * item)
static void drm_deref_user_object(struct drm_file * priv, struct drm_user_object * item)
{
struct drm_device *dev = priv->head->dev;
int ret;
@ -90,7 +90,7 @@ static void drm_deref_user_object(struct drm_file * priv, drm_user_object_t * it
}
}
int drm_remove_user_object(struct drm_file * priv, drm_user_object_t * item)
int drm_remove_user_object(struct drm_file * priv, struct drm_user_object * item)
{
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
@ -105,7 +105,7 @@ int drm_remove_user_object(struct drm_file * priv, drm_user_object_t * item)
return 0;
}
static int drm_object_ref_action(struct drm_file * priv, drm_user_object_t * ro,
static int drm_object_ref_action(struct drm_file * priv, struct drm_user_object * ro,
drm_ref_t action)
{
int ret = 0;
@ -124,12 +124,12 @@ static int drm_object_ref_action(struct drm_file * priv, drm_user_object_t * ro,
return ret;
}
int drm_add_ref_object(struct drm_file * priv, drm_user_object_t * referenced_object,
int drm_add_ref_object(struct drm_file * priv, struct drm_user_object * referenced_object,
drm_ref_t ref_action)
{
int ret = 0;
drm_ref_object_t *item;
drm_open_hash_t *ht = &priv->refd_object_hash[ref_action];
struct drm_ref_object *item;
struct drm_open_hash *ht = &priv->refd_object_hash[ref_action];
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
if (!referenced_object->shareable && priv != referenced_object->owner) {
@ -181,11 +181,11 @@ int drm_add_ref_object(struct drm_file * priv, drm_user_object_t * referenced_ob
return ret;
}
drm_ref_object_t *drm_lookup_ref_object(struct drm_file * priv,
drm_user_object_t * referenced_object,
struct drm_ref_object *drm_lookup_ref_object(struct drm_file * priv,
struct drm_user_object * referenced_object,
drm_ref_t ref_action)
{
drm_hash_item_t *hash;
struct drm_hash_item *hash;
int ret;
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
@ -194,31 +194,31 @@ drm_ref_object_t *drm_lookup_ref_object(struct drm_file * priv,
if (ret)
return NULL;
return drm_hash_entry(hash, drm_ref_object_t, hash);
return drm_hash_entry(hash, struct drm_ref_object, hash);
}
static void drm_remove_other_references(struct drm_file * priv,
drm_user_object_t * ro)
struct drm_user_object * ro)
{
int i;
drm_open_hash_t *ht;
drm_hash_item_t *hash;
drm_ref_object_t *item;
struct drm_open_hash *ht;
struct drm_hash_item *hash;
struct drm_ref_object *item;
for (i = _DRM_REF_USE + 1; i < _DRM_NO_REF_TYPES; ++i) {
ht = &priv->refd_object_hash[i];
while (!drm_ht_find_item(ht, (unsigned long)ro, &hash)) {
item = drm_hash_entry(hash, drm_ref_object_t, hash);
item = drm_hash_entry(hash, struct drm_ref_object, hash);
drm_remove_ref_object(priv, item);
}
}
}
void drm_remove_ref_object(struct drm_file * priv, drm_ref_object_t * item)
void drm_remove_ref_object(struct drm_file * priv, struct drm_ref_object * item)
{
int ret;
drm_user_object_t *user_object = (drm_user_object_t *) item->hash.key;
drm_open_hash_t *ht = &priv->refd_object_hash[item->unref_action];
struct drm_user_object *user_object = (struct drm_user_object *) item->hash.key;
struct drm_open_hash *ht = &priv->refd_object_hash[item->unref_action];
drm_ref_t unref_action;
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
@ -245,11 +245,11 @@ void drm_remove_ref_object(struct drm_file * priv, drm_ref_object_t * item)
}
int drm_user_object_ref(struct drm_file * priv, uint32_t user_token,
drm_object_type_t type, drm_user_object_t ** object)
enum drm_object_type type, struct drm_user_object ** object)
{
struct drm_device *dev = priv->head->dev;
drm_user_object_t *uo;
drm_hash_item_t *hash;
struct drm_user_object *uo;
struct drm_hash_item *hash;
int ret;
mutex_lock(&dev->struct_mutex);
@ -258,7 +258,7 @@ int drm_user_object_ref(struct drm_file * priv, uint32_t user_token,
DRM_ERROR("Could not find user object to reference.\n");
goto out_err;
}
uo = drm_hash_entry(hash, drm_user_object_t, hash);
uo = drm_hash_entry(hash, struct drm_user_object, hash);
if (uo->type != type) {
ret = -EINVAL;
goto out_err;
@ -275,11 +275,11 @@ int drm_user_object_ref(struct drm_file * priv, uint32_t user_token,
}
int drm_user_object_unref(struct drm_file * priv, uint32_t user_token,
drm_object_type_t type)
enum drm_object_type type)
{
struct drm_device *dev = priv->head->dev;
drm_user_object_t *uo;
drm_ref_object_t *ro;
struct drm_user_object *uo;
struct drm_ref_object *ro;
int ret;
mutex_lock(&dev->struct_mutex);

View File

@ -39,14 +39,14 @@ struct drm_device;
#define drm_user_object_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
typedef enum {
enum drm_object_type {
drm_fence_type,
drm_buffer_type,
drm_ttm_type
/*
* Add other user space object types here.
*/
} drm_object_type_t;
};
/*
* A user object is a structure that helps the drm give out user handles
@ -55,10 +55,10 @@ typedef enum {
* Designed to be accessible using a user space 32-bit handle.
*/
typedef struct drm_user_object {
drm_hash_item_t hash;
struct drm_user_object {
struct drm_hash_item hash;
struct list_head list;
drm_object_type_t type;
enum drm_object_type type;
atomic_t refcount;
int shareable;
struct drm_file *owner;
@ -68,7 +68,7 @@ typedef struct drm_user_object {
void (*unref) (struct drm_file * priv, struct drm_user_object * obj,
drm_ref_t unref_action);
void (*remove) (struct drm_file * priv, struct drm_user_object * obj);
} drm_user_object_t;
};
/*
* A ref object is a structure which is used to
@ -77,24 +77,24 @@ typedef struct drm_user_object {
* process exits. Designed to be accessible using a pointer to the _user_ object.
*/
typedef struct drm_ref_object {
drm_hash_item_t hash;
struct drm_ref_object {
struct drm_hash_item hash;
struct list_head list;
atomic_t refcount;
drm_ref_t unref_action;
} drm_ref_object_t;
};
/**
* Must be called with the struct_mutex held.
*/
extern int drm_add_user_object(struct drm_file * priv, drm_user_object_t * item,
extern int drm_add_user_object(struct drm_file * priv, struct drm_user_object * item,
int shareable);
/**
* Must be called with the struct_mutex held.
*/
extern drm_user_object_t *drm_lookup_user_object(struct drm_file * priv,
extern struct drm_user_object *drm_lookup_user_object(struct drm_file * priv,
uint32_t key);
/*
@ -104,22 +104,22 @@ extern drm_user_object_t *drm_lookup_user_object(struct drm_file * priv,
* This function may temporarily release the struct_mutex.
*/
extern int drm_remove_user_object(struct drm_file * priv, drm_user_object_t * item);
extern int drm_remove_user_object(struct drm_file * priv, struct drm_user_object * item);
/*
* Must be called with the struct_mutex held. May temporarily release it.
*/
extern int drm_add_ref_object(struct drm_file * priv,
drm_user_object_t * referenced_object,
struct drm_user_object * referenced_object,
drm_ref_t ref_action);
/*
* Must be called with the struct_mutex held.
*/
drm_ref_object_t *drm_lookup_ref_object(struct drm_file * priv,
drm_user_object_t * referenced_object,
struct drm_ref_object *drm_lookup_ref_object(struct drm_file * priv,
struct drm_user_object * referenced_object,
drm_ref_t ref_action);
/*
* Must be called with the struct_mutex held.
@ -128,19 +128,19 @@ drm_ref_object_t *drm_lookup_ref_object(struct drm_file * priv,
* This function may temporarily release the struct_mutex.
*/
extern void drm_remove_ref_object(struct drm_file * priv, drm_ref_object_t * item);
extern void drm_remove_ref_object(struct drm_file * priv, struct drm_ref_object * item);
extern int drm_user_object_ref(struct drm_file * priv, uint32_t user_token,
drm_object_type_t type,
drm_user_object_t ** object);
enum drm_object_type type,
struct drm_user_object ** object);
extern int drm_user_object_unref(struct drm_file * priv, uint32_t user_token,
drm_object_type_t type);
enum drm_object_type type);
/***************************************************
* Fence objects. (drm_fence.c)
*/
typedef struct drm_fence_object {
drm_user_object_t base;
struct drm_user_object base;
struct drm_device *dev;
atomic_t usage;
@ -328,7 +328,7 @@ typedef struct drm_bo_mem_reg {
typedef struct drm_buffer_object {
struct drm_device *dev;
drm_user_object_t base;
struct drm_user_object base;
/*
* If there is a possibility that the usage variable is zero,

View File

@ -39,12 +39,12 @@
#include "drm_sman.h"
typedef struct drm_owner_item {
drm_hash_item_t owner_hash;
struct drm_hash_item owner_hash;
struct list_head sman_list;
struct list_head mem_blocks;
} drm_owner_item_t;
void drm_sman_takedown(drm_sman_t * sman)
void drm_sman_takedown(struct drm_sman * sman)
{
drm_ht_remove(&sman->user_hash_tab);
drm_ht_remove(&sman->owner_hash_tab);
@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
EXPORT_SYMBOL(drm_sman_takedown);
int
drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
unsigned int user_order, unsigned int owner_order)
{
int ret = 0;
sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm),
sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm),
DRM_MEM_MM);
if (!sman->mm) {
ret = -ENOMEM;
@ -120,10 +120,10 @@ static unsigned long drm_sman_mm_offset(void *private, void *ref)
}
int
drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
unsigned long start, unsigned long size)
{
drm_sman_mm_t *sman_mm;
struct drm_sman_mm *sman_mm;
struct drm_mm *mm;
int ret;
@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
EXPORT_SYMBOL(drm_sman_set_range);
int
drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
drm_sman_mm_t * allocator)
drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
struct drm_sman_mm * allocator)
{
BUG_ON(manager >= sman->num_managers);
sman->mm[manager] = *allocator;
@ -163,11 +163,11 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
}
EXPORT_SYMBOL(drm_sman_set_manager);
static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman,
static drm_owner_item_t *drm_sman_get_owner_item(struct drm_sman * sman,
unsigned long owner)
{
int ret;
drm_hash_item_t *owner_hash_item;
struct drm_hash_item *owner_hash_item;
drm_owner_item_t *owner_item;
ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item);
@ -194,14 +194,14 @@ out:
return NULL;
}
drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager,
struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager,
unsigned long size, unsigned alignment,
unsigned long owner)
{
void *tmp;
drm_sman_mm_t *sman_mm;
struct drm_sman_mm *sman_mm;
drm_owner_item_t *owner_item;
drm_memblock_item_t *memblock;
struct drm_memblock_item *memblock;
BUG_ON(manager >= sman->num_managers);
@ -246,9 +246,9 @@ out:
EXPORT_SYMBOL(drm_sman_alloc);
static void drm_sman_free(drm_memblock_item_t *item)
static void drm_sman_free(struct drm_memblock_item *item)
{
drm_sman_t *sman = item->sman;
struct drm_sman *sman = item->sman;
list_del(&item->owner_list);
drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash);
@ -256,22 +256,22 @@ static void drm_sman_free(drm_memblock_item_t *item)
drm_free(item, sizeof(*item), DRM_MEM_MM);
}
int drm_sman_free_key(drm_sman_t *sman, unsigned int key)
int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
{
drm_hash_item_t *hash_item;
drm_memblock_item_t *memblock_item;
struct drm_hash_item *hash_item;
struct drm_memblock_item *memblock_item;
if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
return -EINVAL;
memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash);
memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, user_hash);
drm_sman_free(memblock_item);
return 0;
}
EXPORT_SYMBOL(drm_sman_free_key);
static void drm_sman_remove_owner(drm_sman_t *sman,
static void drm_sman_remove_owner(struct drm_sman *sman,
drm_owner_item_t *owner_item)
{
list_del(&owner_item->sman_list);
@ -279,10 +279,10 @@ static void drm_sman_remove_owner(drm_sman_t *sman,
drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM);
}
int drm_sman_owner_clean(drm_sman_t *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;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
@ -300,10 +300,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_clean);
static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
drm_owner_item_t *owner_item)
{
drm_memblock_item_t *entry, *next;
struct drm_memblock_item *entry, *next;
list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
owner_list) {
@ -312,10 +312,10 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
drm_sman_remove_owner(sman, owner_item);
}
void drm_sman_owner_cleanup(drm_sman_t *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;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
@ -329,11 +329,11 @@ void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_cleanup);
void drm_sman_cleanup(drm_sman_t *sman)
void drm_sman_cleanup(struct drm_sman *sman)
{
drm_owner_item_t *entry, *next;
unsigned int i;
drm_sman_mm_t *sman_mm;
struct drm_sman_mm *sman_mm;
list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
drm_sman_do_owner_cleanup(sman, entry);

View File

@ -50,7 +50,7 @@
* for memory management.
*/
typedef struct drm_sman_mm {
struct drm_sman_mm {
/* private info. If allocated, needs to be destroyed by the destroy
function */
void *private;
@ -74,30 +74,30 @@ typedef struct drm_sman_mm {
"alloc" function */
unsigned long (*offset) (void *private, void *ref);
} drm_sman_mm_t;
};
typedef struct drm_memblock_item {
struct drm_memblock_item {
struct list_head owner_list;
drm_hash_item_t user_hash;
struct drm_hash_item user_hash;
void *mm_info;
drm_sman_mm_t *mm;
struct drm_sman_mm *mm;
struct drm_sman *sman;
} drm_memblock_item_t;
};
typedef struct drm_sman {
drm_sman_mm_t *mm;
struct drm_sman {
struct drm_sman_mm *mm;
int num_managers;
drm_open_hash_t owner_hash_tab;
drm_open_hash_t user_hash_tab;
struct drm_open_hash owner_hash_tab;
struct drm_open_hash user_hash_tab;
struct list_head owner_items;
} drm_sman_t;
};
/*
* Take down a memory manager. This function should only be called after a
* successful init and after a call to drm_sman_cleanup.
*/
extern void drm_sman_takedown(drm_sman_t * sman);
extern void drm_sman_takedown(struct drm_sman * sman);
/*
* Allocate structures for a manager.
@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman);
*
*/
extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
unsigned int user_order, unsigned int owner_order);
/*
@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
* manager unless a customized allogator is used.
*/
extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
unsigned long start, unsigned long size);
/*
@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
* so it can be destroyed after this call.
*/
extern int drm_sman_set_manager(drm_sman_t * sman, unsigned int mananger,
drm_sman_mm_t * allocator);
extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
struct drm_sman_mm * allocator);
/*
* Allocate a memory block. Aligment is not implemented yet.
*/
extern drm_memblock_item_t *drm_sman_alloc(drm_sman_t * sman,
unsigned int manager,
unsigned long size,
unsigned alignment,
unsigned long owner);
extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
unsigned int manager,
unsigned long size,
unsigned alignment,
unsigned long owner);
/*
* Free a memory block identified by its user hash key.
*/
extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key);
extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
/*
* returns 1 iff there are no stale memory blocks associated with this owner.
@ -154,7 +154,7 @@ extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key);
* resources associated with owner.
*/
extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner);
extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
/*
* Frees all stale memory blocks associated with this owner. Note that this
@ -164,13 +164,13 @@ extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner);
* is not going to be referenced anymore.
*/
extern void drm_sman_owner_cleanup(drm_sman_t * sman, unsigned long owner);
extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
/*
* Frees all stale memory blocks associated with the memory manager.
* See idling above.
*/
extern void drm_sman_cleanup(drm_sman_t * sman);
extern void drm_sman_cleanup(struct drm_sman * sman);
#endif

View File

@ -93,7 +93,7 @@ static int sis_fb_init(DRM_IOCTL_ARGS)
mutex_lock(&dev->struct_mutex);
#if defined(__linux__) && defined(CONFIG_FB_SIS)
{
drm_sman_mm_t sman_mm;
struct drm_sman_mm sman_mm;
sman_mm.private = (void *)0xFFFFFFFF;
sman_mm.allocate = sis_sman_mm_allocate;
sman_mm.free = sis_sman_mm_free;
@ -129,7 +129,7 @@ static int sis_drm_alloc(struct drm_device * dev, struct drm_file * priv,
drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *) data;
drm_sis_mem_t mem;
int retval = 0;
drm_memblock_item_t *item;
struct drm_memblock_item *item;
DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem));

View File

@ -129,7 +129,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
drm_via_mem_t mem;
int retval = 0;
drm_memblock_item_t *item;
struct drm_memblock_item *item;
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
unsigned long tmpSize;

View File

@ -58,7 +58,7 @@ enum sis_family {
typedef struct drm_sis_private {
drm_local_map_t *mmio;
unsigned int idle_fault;
drm_sman_t sman;
struct drm_sman sman;
unsigned int chipset;
int vram_initialized;
int agp_initialized;

View File

@ -116,7 +116,7 @@ typedef struct drm_via_private {
/* Memory manager stuff */
#ifdef VIA_HAVE_CORE_MM
unsigned int idle_fault;
drm_sman_t sman;
struct drm_sman sman;
int vram_initialized;
int agp_initialized;
unsigned long vram_offset;