aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-07-11 20:21:05 -0400
committerDave Airlie <airlied@linux.ie>2007-07-11 20:21:05 -0400
commit9698b4dba42eb758ad98012c21e5fbdb372fe2d9 (patch)
tree5be810137553bd3885f34f89f2386aa32c3a9fa4 /drivers/char
parent55910517af381eba4f978740e5e46e23eb269326 (diff)
drm: de-typedef sman
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/drm/drm_sman.c47
-rw-r--r--drivers/char/drm/drm_sman.h44
-rw-r--r--drivers/char/drm/sis_drv.h3
-rw-r--r--drivers/char/drm/sis_mm.c2
-rw-r--r--drivers/char/drm/via_drv.h2
-rw-r--r--drivers/char/drm/via_mm.c2
6 files changed, 51 insertions, 49 deletions
diff --git a/drivers/char/drm/drm_sman.c b/drivers/char/drm/drm_sman.c
index 8e4bfbd89632..5a075f070c6a 100644
--- a/drivers/char/drm/drm_sman.c
+++ b/drivers/char/drm/drm_sman.c
@@ -44,7 +44,7 @@ typedef struct drm_owner_item {
44 struct list_head mem_blocks; 44 struct list_head mem_blocks;
45} drm_owner_item_t; 45} drm_owner_item_t;
46 46
47void drm_sman_takedown(drm_sman_t * sman) 47void drm_sman_takedown(struct drm_sman * sman)
48{ 48{
49 drm_ht_remove(&sman->user_hash_tab); 49 drm_ht_remove(&sman->user_hash_tab);
50 drm_ht_remove(&sman->owner_hash_tab); 50 drm_ht_remove(&sman->owner_hash_tab);
@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
56EXPORT_SYMBOL(drm_sman_takedown); 56EXPORT_SYMBOL(drm_sman_takedown);
57 57
58int 58int
59drm_sman_init(drm_sman_t * sman, unsigned int num_managers, 59drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
60 unsigned int user_order, unsigned int owner_order) 60 unsigned int user_order, unsigned int owner_order)
61{ 61{
62 int ret = 0; 62 int ret = 0;
63 63
64 sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm), 64 sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm),
65 DRM_MEM_MM); 65 DRM_MEM_MM);
66 if (!sman->mm) { 66 if (!sman->mm) {
67 ret = -ENOMEM; 67 ret = -ENOMEM;
@@ -120,10 +120,10 @@ static unsigned long drm_sman_mm_offset(void *private, void *ref)
120} 120}
121 121
122int 122int
123drm_sman_set_range(drm_sman_t * sman, unsigned int manager, 123drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size) 124 unsigned long start, unsigned long size)
125{ 125{
126 drm_sman_mm_t *sman_mm; 126 struct drm_sman_mm *sman_mm;
127 struct drm_mm *mm; 127 struct drm_mm *mm;
128 int ret; 128 int ret;
129 129
@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
153EXPORT_SYMBOL(drm_sman_set_range); 153EXPORT_SYMBOL(drm_sman_set_range);
154 154
155int 155int
156drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, 156drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
157 drm_sman_mm_t * allocator) 157 struct drm_sman_mm * allocator)
158{ 158{
159 BUG_ON(manager >= sman->num_managers); 159 BUG_ON(manager >= sman->num_managers);
160 sman->mm[manager] = *allocator; 160 sman->mm[manager] = *allocator;
@@ -163,7 +163,7 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
163} 163}
164EXPORT_SYMBOL(drm_sman_set_manager); 164EXPORT_SYMBOL(drm_sman_set_manager);
165 165
166static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, 166static drm_owner_item_t *drm_sman_get_owner_item(struct drm_sman * sman,
167 unsigned long owner) 167 unsigned long owner)
168{ 168{
169 int ret; 169 int ret;
@@ -194,14 +194,14 @@ out:
194 return NULL; 194 return NULL;
195} 195}
196 196
197drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, 197struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager,
198 unsigned long size, unsigned alignment, 198 unsigned long size, unsigned alignment,
199 unsigned long owner) 199 unsigned long owner)
200{ 200{
201 void *tmp; 201 void *tmp;
202 drm_sman_mm_t *sman_mm; 202 struct drm_sman_mm *sman_mm;
203 drm_owner_item_t *owner_item; 203 drm_owner_item_t *owner_item;
204 drm_memblock_item_t *memblock; 204 struct drm_memblock_item *memblock;
205 205
206 BUG_ON(manager >= sman->num_managers); 206 BUG_ON(manager >= sman->num_managers);
207 207
@@ -246,9 +246,9 @@ out:
246 246
247EXPORT_SYMBOL(drm_sman_alloc); 247EXPORT_SYMBOL(drm_sman_alloc);
248 248
249static void drm_sman_free(drm_memblock_item_t *item) 249static void drm_sman_free(struct drm_memblock_item *item)
250{ 250{
251 drm_sman_t *sman = item->sman; 251 struct drm_sman *sman = item->sman;
252 252
253 list_del(&item->owner_list); 253 list_del(&item->owner_list);
254 drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); 254 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 drm_free(item, sizeof(*item), DRM_MEM_MM); 256 drm_free(item, sizeof(*item), DRM_MEM_MM);
257} 257}
258 258
259int drm_sman_free_key(drm_sman_t *sman, unsigned int key) 259int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
260{ 260{
261 drm_hash_item_t *hash_item; 261 drm_hash_item_t *hash_item;
262 drm_memblock_item_t *memblock_item; 262 struct drm_memblock_item *memblock_item;
263 263
264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) 264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
265 return -EINVAL; 265 return -EINVAL;
266 266
267 memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash); 267 memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item,
268 user_hash);
268 drm_sman_free(memblock_item); 269 drm_sman_free(memblock_item);
269 return 0; 270 return 0;
270} 271}
271 272
272EXPORT_SYMBOL(drm_sman_free_key); 273EXPORT_SYMBOL(drm_sman_free_key);
273 274
274static void drm_sman_remove_owner(drm_sman_t *sman, 275static void drm_sman_remove_owner(struct drm_sman *sman,
275 drm_owner_item_t *owner_item) 276 drm_owner_item_t *owner_item)
276{ 277{
277 list_del(&owner_item->sman_list); 278 list_del(&owner_item->sman_list);
@@ -279,7 +280,7 @@ static void drm_sman_remove_owner(drm_sman_t *sman,
279 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); 280 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM);
280} 281}
281 282
282int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) 283int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
283{ 284{
284 285
285 drm_hash_item_t *hash_item; 286 drm_hash_item_t *hash_item;
@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
300 301
301EXPORT_SYMBOL(drm_sman_owner_clean); 302EXPORT_SYMBOL(drm_sman_owner_clean);
302 303
303static void drm_sman_do_owner_cleanup(drm_sman_t *sman, 304static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
304 drm_owner_item_t *owner_item) 305 drm_owner_item_t *owner_item)
305{ 306{
306 drm_memblock_item_t *entry, *next; 307 struct drm_memblock_item *entry, *next;
307 308
308 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, 309 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
309 owner_list) { 310 owner_list) {
@@ -312,7 +313,7 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
312 drm_sman_remove_owner(sman, owner_item); 313 drm_sman_remove_owner(sman, owner_item);
313} 314}
314 315
315void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) 316void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner)
316{ 317{
317 318
318 drm_hash_item_t *hash_item; 319 drm_hash_item_t *hash_item;
@@ -329,11 +330,11 @@ void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner)
329 330
330EXPORT_SYMBOL(drm_sman_owner_cleanup); 331EXPORT_SYMBOL(drm_sman_owner_cleanup);
331 332
332void drm_sman_cleanup(drm_sman_t *sman) 333void drm_sman_cleanup(struct drm_sman *sman)
333{ 334{
334 drm_owner_item_t *entry, *next; 335 drm_owner_item_t *entry, *next;
335 unsigned int i; 336 unsigned int i;
336 drm_sman_mm_t *sman_mm; 337 struct drm_sman_mm *sman_mm;
337 338
338 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) { 339 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
339 drm_sman_do_owner_cleanup(sman, entry); 340 drm_sman_do_owner_cleanup(sman, entry);
diff --git a/drivers/char/drm/drm_sman.h b/drivers/char/drm/drm_sman.h
index ddc732a1bf27..2fef3b2bb613 100644
--- a/drivers/char/drm/drm_sman.h
+++ b/drivers/char/drm/drm_sman.h
@@ -50,7 +50,7 @@
50 * for memory management. 50 * for memory management.
51 */ 51 */
52 52
53typedef struct drm_sman_mm { 53struct drm_sman_mm {
54 /* private info. If allocated, needs to be destroyed by the destroy 54 /* private info. If allocated, needs to be destroyed by the destroy
55 function */ 55 function */
56 void *private; 56 void *private;
@@ -74,30 +74,30 @@ typedef struct drm_sman_mm {
74 "alloc" function */ 74 "alloc" function */
75 75
76 unsigned long (*offset) (void *private, void *ref); 76 unsigned long (*offset) (void *private, void *ref);
77} drm_sman_mm_t; 77};
78 78
79typedef struct drm_memblock_item { 79struct drm_memblock_item {
80 struct list_head owner_list; 80 struct list_head owner_list;
81 drm_hash_item_t user_hash; 81 drm_hash_item_t user_hash;
82 void *mm_info; 82 void *mm_info;
83 drm_sman_mm_t *mm; 83 struct drm_sman_mm *mm;
84 struct drm_sman *sman; 84 struct drm_sman *sman;
85} drm_memblock_item_t; 85};
86 86
87typedef struct drm_sman { 87struct drm_sman {
88 drm_sman_mm_t *mm; 88 struct drm_sman_mm *mm;
89 int num_managers; 89 int num_managers;
90 drm_open_hash_t owner_hash_tab; 90 drm_open_hash_t owner_hash_tab;
91 drm_open_hash_t user_hash_tab; 91 drm_open_hash_t user_hash_tab;
92 struct list_head owner_items; 92 struct list_head owner_items;
93} drm_sman_t; 93};
94 94
95/* 95/*
96 * Take down a memory manager. This function should only be called after a 96 * Take down a memory manager. This function should only be called after a
97 * successful init and after a call to drm_sman_cleanup. 97 * successful init and after a call to drm_sman_cleanup.
98 */ 98 */
99 99
100extern void drm_sman_takedown(drm_sman_t * sman); 100extern void drm_sman_takedown(struct drm_sman * sman);
101 101
102/* 102/*
103 * Allocate structures for a manager. 103 * Allocate structures for a manager.
@@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman);
112 * 112 *
113 */ 113 */
114 114
115extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers, 115extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
116 unsigned int user_order, unsigned int owner_order); 116 unsigned int user_order, unsigned int owner_order);
117 117
118/* 118/*
@@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
120 * manager unless a customized allogator is used. 120 * manager unless a customized allogator is used.
121 */ 121 */
122 122
123extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, 123extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size); 124 unsigned long start, unsigned long size);
125 125
126/* 126/*
@@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
129 * so it can be destroyed after this call. 129 * so it can be destroyed after this call.
130 */ 130 */
131 131
132extern int drm_sman_set_manager(drm_sman_t * sman, unsigned int mananger, 132extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
133 drm_sman_mm_t * allocator); 133 struct drm_sman_mm * allocator);
134 134
135/* 135/*
136 * Allocate a memory block. Aligment is not implemented yet. 136 * Allocate a memory block. Aligment is not implemented yet.
137 */ 137 */
138 138
139extern drm_memblock_item_t *drm_sman_alloc(drm_sman_t * sman, 139extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
140 unsigned int manager, 140 unsigned int manager,
141 unsigned long size, 141 unsigned long size,
142 unsigned alignment, 142 unsigned alignment,
143 unsigned long owner); 143 unsigned long owner);
144/* 144/*
145 * Free a memory block identified by its user hash key. 145 * Free a memory block identified by its user hash key.
146 */ 146 */
147 147
148extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key); 148extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
149 149
150/* 150/*
151 * returns 1 iff there are no stale memory blocks associated with this owner. 151 * 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 * resources associated with owner. 154 * resources associated with owner.
155 */ 155 */
156 156
157extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner); 157extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
158 158
159/* 159/*
160 * Frees all stale memory blocks associated with this owner. Note that this 160 * 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 * is not going to be referenced anymore. 164 * is not going to be referenced anymore.
165 */ 165 */
166 166
167extern void drm_sman_owner_cleanup(drm_sman_t * sman, unsigned long owner); 167extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
168 168
169/* 169/*
170 * Frees all stale memory blocks associated with the memory manager. 170 * Frees all stale memory blocks associated with the memory manager.
171 * See idling above. 171 * See idling above.
172 */ 172 */
173 173
174extern void drm_sman_cleanup(drm_sman_t * sman); 174extern void drm_sman_cleanup(struct drm_sman * sman);
175 175
176#endif 176#endif
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h
index 83c0ef264a15..5630df874353 100644
--- a/drivers/char/drm/sis_drv.h
+++ b/drivers/char/drm/sis_drv.h
@@ -46,6 +46,7 @@ enum sis_family {
46 46
47#include "drm_sman.h" 47#include "drm_sman.h"
48 48
49
49#define SIS_BASE (dev_priv->mmio) 50#define SIS_BASE (dev_priv->mmio)
50#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg); 51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg);
51#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val); 52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val);
@@ -53,7 +54,7 @@ enum sis_family {
53typedef struct drm_sis_private { 54typedef struct drm_sis_private {
54 drm_local_map_t *mmio; 55 drm_local_map_t *mmio;
55 unsigned int idle_fault; 56 unsigned int idle_fault;
56 drm_sman_t sman; 57 struct drm_sman sman;
57 unsigned int chipset; 58 unsigned int chipset;
58 int vram_initialized; 59 int vram_initialized;
59 int agp_initialized; 60 int agp_initialized;
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index e524b66a8ee9..0580fa33cb77 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -130,7 +130,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
130 drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *) data; 130 drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *) data;
131 drm_sis_mem_t mem; 131 drm_sis_mem_t mem;
132 int retval = 0; 132 int retval = 0;
133 drm_memblock_item_t *item; 133 struct drm_memblock_item *item;
134 134
135 DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem)); 135 DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem));
136 136
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h
index 11416b956845..576711564a11 100644
--- a/drivers/char/drm/via_drv.h
+++ b/drivers/char/drm/via_drv.h
@@ -87,7 +87,7 @@ typedef struct drm_via_private {
87 uint32_t irq_pending_mask; 87 uint32_t irq_pending_mask;
88 int *irq_map; 88 int *irq_map;
89 unsigned int idle_fault; 89 unsigned int idle_fault;
90 drm_sman_t sman; 90 struct drm_sman sman;
91 int vram_initialized; 91 int vram_initialized;
92 int agp_initialized; 92 int agp_initialized;
93 unsigned long vram_offset; 93 unsigned long vram_offset;
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c
index b609c48d07f2..85d56acd9d82 100644
--- a/drivers/char/drm/via_mm.c
+++ b/drivers/char/drm/via_mm.c
@@ -127,7 +127,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
127 127
128 drm_via_mem_t mem; 128 drm_via_mem_t mem;
129 int retval = 0; 129 int retval = 0;
130 drm_memblock_item_t *item; 130 struct drm_memblock_item *item;
131 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 131 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
132 unsigned long tmpSize; 132 unsigned long tmpSize;
133 133