Commit 9698b4db authored by Dave Airlie's avatar Dave Airlie

drm: de-typedef sman

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 55910517
...@@ -44,7 +44,7 @@ typedef struct drm_owner_item { ...@@ -44,7 +44,7 @@ typedef struct drm_owner_item {
struct list_head mem_blocks; struct list_head mem_blocks;
} drm_owner_item_t; } 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->user_hash_tab);
drm_ht_remove(&sman->owner_hash_tab); drm_ht_remove(&sman->owner_hash_tab);
...@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman) ...@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
EXPORT_SYMBOL(drm_sman_takedown); EXPORT_SYMBOL(drm_sman_takedown);
int 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) unsigned int user_order, unsigned int owner_order)
{ {
int ret = 0; 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); DRM_MEM_MM);
if (!sman->mm) { if (!sman->mm) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -120,10 +120,10 @@ static unsigned long drm_sman_mm_offset(void *private, void *ref) ...@@ -120,10 +120,10 @@ static unsigned long drm_sman_mm_offset(void *private, void *ref)
} }
int 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) unsigned long start, unsigned long size)
{ {
drm_sman_mm_t *sman_mm; struct drm_sman_mm *sman_mm;
struct drm_mm *mm; struct drm_mm *mm;
int ret; int ret;
...@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager, ...@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
EXPORT_SYMBOL(drm_sman_set_range); EXPORT_SYMBOL(drm_sman_set_range);
int int
drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
drm_sman_mm_t * allocator) struct drm_sman_mm * allocator)
{ {
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
sman->mm[manager] = *allocator; sman->mm[manager] = *allocator;
...@@ -163,7 +163,7 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, ...@@ -163,7 +163,7 @@ drm_sman_set_manager(drm_sman_t * 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(drm_sman_t * sman, static drm_owner_item_t *drm_sman_get_owner_item(struct drm_sman * sman,
unsigned long owner) unsigned long owner)
{ {
int ret; int ret;
...@@ -194,14 +194,14 @@ static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, ...@@ -194,14 +194,14 @@ static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman,
return NULL; 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 size, unsigned alignment,
unsigned long owner) unsigned long owner)
{ {
void *tmp; void *tmp;
drm_sman_mm_t *sman_mm; struct drm_sman_mm *sman_mm;
drm_owner_item_t *owner_item; drm_owner_item_t *owner_item;
drm_memblock_item_t *memblock; struct drm_memblock_item *memblock;
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
...@@ -246,9 +246,9 @@ drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, ...@@ -246,9 +246,9 @@ drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager,
EXPORT_SYMBOL(drm_sman_alloc); 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); list_del(&item->owner_list);
drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash);
...@@ -256,22 +256,23 @@ static void drm_sman_free(drm_memblock_item_t *item) ...@@ -256,22 +256,23 @@ static void drm_sman_free(drm_memblock_item_t *item)
drm_free(item, sizeof(*item), DRM_MEM_MM); 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_hash_item_t *hash_item;
drm_memblock_item_t *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))
return -EINVAL; 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); drm_sman_free(memblock_item);
return 0; return 0;
} }
EXPORT_SYMBOL(drm_sman_free_key); 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) drm_owner_item_t *owner_item)
{ {
list_del(&owner_item->sman_list); list_del(&owner_item->sman_list);
...@@ -279,7 +280,7 @@ static void drm_sman_remove_owner(drm_sman_t *sman, ...@@ -279,7 +280,7 @@ static void drm_sman_remove_owner(drm_sman_t *sman,
drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); 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; drm_hash_item_t *hash_item;
...@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) ...@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_clean); 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_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, list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
owner_list) { owner_list) {
...@@ -312,7 +313,7 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman, ...@@ -312,7 +313,7 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
drm_sman_remove_owner(sman, owner_item); 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; drm_hash_item_t *hash_item;
...@@ -329,11 +330,11 @@ void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) ...@@ -329,11 +330,11 @@ void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_cleanup); 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; drm_owner_item_t *entry, *next;
unsigned int i; 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) { list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
drm_sman_do_owner_cleanup(sman, entry); drm_sman_do_owner_cleanup(sman, entry);
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* for memory management. * for memory management.
*/ */
typedef struct drm_sman_mm { struct drm_sman_mm {
/* private info. If allocated, needs to be destroyed by the destroy /* private info. If allocated, needs to be destroyed by the destroy
function */ function */
void *private; void *private;
...@@ -74,30 +74,30 @@ typedef struct drm_sman_mm { ...@@ -74,30 +74,30 @@ typedef struct drm_sman_mm {
"alloc" function */ "alloc" function */
unsigned long (*offset) (void *private, void *ref); 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; struct list_head owner_list;
drm_hash_item_t user_hash; drm_hash_item_t user_hash;
void *mm_info; void *mm_info;
drm_sman_mm_t *mm; struct drm_sman_mm *mm;
struct drm_sman *sman; struct drm_sman *sman;
} drm_memblock_item_t; };
typedef struct drm_sman { struct drm_sman {
drm_sman_mm_t *mm; struct drm_sman_mm *mm;
int num_managers; int num_managers;
drm_open_hash_t owner_hash_tab; drm_open_hash_t owner_hash_tab;
drm_open_hash_t user_hash_tab; drm_open_hash_t user_hash_tab;
struct list_head owner_items; struct list_head owner_items;
} drm_sman_t; };
/* /*
* Take down a memory manager. This function should only be called after a * Take down a memory manager. This function should only be called after a
* successful init and after a call to drm_sman_cleanup. * 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. * Allocate structures for a manager.
...@@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman); ...@@ -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); 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, ...@@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
* manager unless a customized allogator is used. * 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); unsigned long start, unsigned long size);
/* /*
...@@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, ...@@ -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. * so it can be destroyed after this call.
*/ */
extern int drm_sman_set_manager(drm_sman_t * sman, unsigned int mananger, extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
drm_sman_mm_t * allocator); struct drm_sman_mm * allocator);
/* /*
* Allocate a memory block. Aligment is not implemented yet. * Allocate a memory block. Aligment is not implemented yet.
*/ */
extern drm_memblock_item_t *drm_sman_alloc(drm_sman_t * sman, extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
unsigned int manager, unsigned int manager,
unsigned long size, unsigned long size,
unsigned alignment, unsigned alignment,
unsigned long owner); unsigned long owner);
/* /*
* Free a memory block identified by its user hash key. * 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. * 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); ...@@ -154,7 +154,7 @@ extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key);
* resources associated with owner. * 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 * 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); ...@@ -164,13 +164,13 @@ extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner);
* is not going to be referenced anymore. * 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. * Frees all stale memory blocks associated with the memory manager.
* See idling above. * See idling above.
*/ */
extern void drm_sman_cleanup(drm_sman_t * sman); extern void drm_sman_cleanup(struct drm_sman * sman);
#endif #endif
...@@ -46,6 +46,7 @@ enum sis_family { ...@@ -46,6 +46,7 @@ enum sis_family {
#include "drm_sman.h" #include "drm_sman.h"
#define SIS_BASE (dev_priv->mmio) #define SIS_BASE (dev_priv->mmio)
#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg); #define SIS_READ(reg) DRM_READ32(SIS_BASE, reg);
#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val); #define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val);
...@@ -53,7 +54,7 @@ enum sis_family { ...@@ -53,7 +54,7 @@ enum sis_family {
typedef struct drm_sis_private { typedef struct drm_sis_private {
drm_local_map_t *mmio; drm_local_map_t *mmio;
unsigned int idle_fault; unsigned int idle_fault;
drm_sman_t sman; struct drm_sman sman;
unsigned int chipset; unsigned int chipset;
int vram_initialized; int vram_initialized;
int agp_initialized; int agp_initialized;
......
...@@ -130,7 +130,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv, ...@@ -130,7 +130,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 __user *argp = (drm_sis_mem_t __user *) data;
drm_sis_mem_t mem; drm_sis_mem_t mem;
int retval = 0; int retval = 0;
drm_memblock_item_t *item; struct drm_memblock_item *item;
DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem)); DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem));
......
...@@ -87,7 +87,7 @@ typedef struct drm_via_private { ...@@ -87,7 +87,7 @@ typedef struct drm_via_private {
uint32_t irq_pending_mask; uint32_t irq_pending_mask;
int *irq_map; int *irq_map;
unsigned int idle_fault; unsigned int idle_fault;
drm_sman_t sman; struct drm_sman sman;
int vram_initialized; int vram_initialized;
int agp_initialized; int agp_initialized;
unsigned long vram_offset; unsigned long vram_offset;
......
...@@ -127,7 +127,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) ...@@ -127,7 +127,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
drm_via_mem_t mem; drm_via_mem_t mem;
int retval = 0; 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; drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
unsigned long tmpSize; unsigned long tmpSize;
......
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