aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_mm.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-07-11 02:53:40 -0400
committerDave Airlie <airlied@linux.ie>2007-07-11 02:53:40 -0400
commit55910517af381eba4f978740e5e46e23eb269326 (patch)
tree22c82521d05029234634ebbf814b173570f18049 /drivers/char/drm/drm_mm.c
parentcdd55a294c13f8bf05b2f4fee4c96934d5ebd2e4 (diff)
drm: detypedeffing continues...
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_mm.c')
-rw-r--r--drivers/char/drm/drm_mm.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/char/drm/drm_mm.c b/drivers/char/drm/drm_mm.c
index 2ec1d9f26264..3e6bc14f7441 100644
--- a/drivers/char/drm/drm_mm.c
+++ b/drivers/char/drm/drm_mm.c
@@ -44,26 +44,26 @@
44#include "drmP.h" 44#include "drmP.h"
45#include <linux/slab.h> 45#include <linux/slab.h>
46 46
47unsigned long drm_mm_tail_space(drm_mm_t *mm) 47unsigned long drm_mm_tail_space(struct drm_mm *mm)
48{ 48{
49 struct list_head *tail_node; 49 struct list_head *tail_node;
50 drm_mm_node_t *entry; 50 struct drm_mm_node *entry;
51 51
52 tail_node = mm->ml_entry.prev; 52 tail_node = mm->ml_entry.prev;
53 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 53 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
54 if (!entry->free) 54 if (!entry->free)
55 return 0; 55 return 0;
56 56
57 return entry->size; 57 return entry->size;
58} 58}
59 59
60int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size) 60int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size)
61{ 61{
62 struct list_head *tail_node; 62 struct list_head *tail_node;
63 drm_mm_node_t *entry; 63 struct drm_mm_node *entry;
64 64
65 tail_node = mm->ml_entry.prev; 65 tail_node = mm->ml_entry.prev;
66 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 66 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
67 if (!entry->free) 67 if (!entry->free)
68 return -ENOMEM; 68 return -ENOMEM;
69 69
@@ -75,13 +75,13 @@ int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size)
75} 75}
76 76
77 77
78static int drm_mm_create_tail_node(drm_mm_t *mm, 78static int drm_mm_create_tail_node(struct drm_mm *mm,
79 unsigned long start, 79 unsigned long start,
80 unsigned long size) 80 unsigned long size)
81{ 81{
82 drm_mm_node_t *child; 82 struct drm_mm_node *child;
83 83
84 child = (drm_mm_node_t *) 84 child = (struct drm_mm_node *)
85 drm_alloc(sizeof(*child), DRM_MEM_MM); 85 drm_alloc(sizeof(*child), DRM_MEM_MM);
86 if (!child) 86 if (!child)
87 return -ENOMEM; 87 return -ENOMEM;
@@ -98,13 +98,13 @@ static int drm_mm_create_tail_node(drm_mm_t *mm,
98} 98}
99 99
100 100
101int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size) 101int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size)
102{ 102{
103 struct list_head *tail_node; 103 struct list_head *tail_node;
104 drm_mm_node_t *entry; 104 struct drm_mm_node *entry;
105 105
106 tail_node = mm->ml_entry.prev; 106 tail_node = mm->ml_entry.prev;
107 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 107 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
108 if (!entry->free) { 108 if (!entry->free) {
109 return drm_mm_create_tail_node(mm, entry->start + entry->size, size); 109 return drm_mm_create_tail_node(mm, entry->start + entry->size, size);
110 } 110 }
@@ -112,12 +112,12 @@ int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size)
112 return 0; 112 return 0;
113} 113}
114 114
115static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent, 115static struct drm_mm_node *drm_mm_split_at_start(struct drm_mm_node *parent,
116 unsigned long size) 116 unsigned long size)
117{ 117{
118 drm_mm_node_t *child; 118 struct drm_mm_node *child;
119 119
120 child = (drm_mm_node_t *) 120 child = (struct drm_mm_node *)
121 drm_alloc(sizeof(*child), DRM_MEM_MM); 121 drm_alloc(sizeof(*child), DRM_MEM_MM);
122 if (!child) 122 if (!child)
123 return NULL; 123 return NULL;
@@ -139,12 +139,12 @@ static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent,
139 139
140 140
141 141
142drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, 142struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
143 unsigned long size, unsigned alignment) 143 unsigned long size, unsigned alignment)
144{ 144{
145 145
146 drm_mm_node_t *align_splitoff = NULL; 146 struct drm_mm_node *align_splitoff = NULL;
147 drm_mm_node_t *child; 147 struct drm_mm_node *child;
148 unsigned tmp = 0; 148 unsigned tmp = 0;
149 149
150 if (alignment) 150 if (alignment)
@@ -175,26 +175,26 @@ drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
175 * Otherwise add to the free stack. 175 * Otherwise add to the free stack.
176 */ 176 */
177 177
178void drm_mm_put_block(drm_mm_node_t * cur) 178void drm_mm_put_block(struct drm_mm_node * cur)
179{ 179{
180 180
181 drm_mm_t *mm = cur->mm; 181 struct drm_mm *mm = cur->mm;
182 struct list_head *cur_head = &cur->ml_entry; 182 struct list_head *cur_head = &cur->ml_entry;
183 struct list_head *root_head = &mm->ml_entry; 183 struct list_head *root_head = &mm->ml_entry;
184 drm_mm_node_t *prev_node = NULL; 184 struct drm_mm_node *prev_node = NULL;
185 drm_mm_node_t *next_node; 185 struct drm_mm_node *next_node;
186 186
187 int merged = 0; 187 int merged = 0;
188 188
189 if (cur_head->prev != root_head) { 189 if (cur_head->prev != root_head) {
190 prev_node = list_entry(cur_head->prev, drm_mm_node_t, ml_entry); 190 prev_node = list_entry(cur_head->prev, struct drm_mm_node, ml_entry);
191 if (prev_node->free) { 191 if (prev_node->free) {
192 prev_node->size += cur->size; 192 prev_node->size += cur->size;
193 merged = 1; 193 merged = 1;
194 } 194 }
195 } 195 }
196 if (cur_head->next != root_head) { 196 if (cur_head->next != root_head) {
197 next_node = list_entry(cur_head->next, drm_mm_node_t, ml_entry); 197 next_node = list_entry(cur_head->next, struct drm_mm_node, ml_entry);
198 if (next_node->free) { 198 if (next_node->free) {
199 if (merged) { 199 if (merged) {
200 prev_node->size += next_node->size; 200 prev_node->size += next_node->size;
@@ -218,14 +218,14 @@ void drm_mm_put_block(drm_mm_node_t * cur)
218 } 218 }
219} 219}
220 220
221drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, 221struct drm_mm_node *drm_mm_search_free(const struct drm_mm * mm,
222 unsigned long size, 222 unsigned long size,
223 unsigned alignment, int best_match) 223 unsigned alignment, int best_match)
224{ 224{
225 struct list_head *list; 225 struct list_head *list;
226 const struct list_head *free_stack = &mm->fl_entry; 226 const struct list_head *free_stack = &mm->fl_entry;
227 drm_mm_node_t *entry; 227 struct drm_mm_node *entry;
228 drm_mm_node_t *best; 228 struct drm_mm_node *best;
229 unsigned long best_size; 229 unsigned long best_size;
230 unsigned wasted; 230 unsigned wasted;
231 231
@@ -233,7 +233,7 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
233 best_size = ~0UL; 233 best_size = ~0UL;
234 234
235 list_for_each(list, free_stack) { 235 list_for_each(list, free_stack) {
236 entry = list_entry(list, drm_mm_node_t, fl_entry); 236 entry = list_entry(list, struct drm_mm_node, fl_entry);
237 wasted = 0; 237 wasted = 0;
238 238
239 if (entry->size < size) 239 if (entry->size < size)
@@ -259,14 +259,14 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
259 return best; 259 return best;
260} 260}
261 261
262int drm_mm_clean(drm_mm_t * mm) 262int drm_mm_clean(struct drm_mm * mm)
263{ 263{
264 struct list_head *head = &mm->ml_entry; 264 struct list_head *head = &mm->ml_entry;
265 265
266 return (head->next->next == head); 266 return (head->next->next == head);
267} 267}
268 268
269int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size) 269int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
270{ 270{
271 INIT_LIST_HEAD(&mm->ml_entry); 271 INIT_LIST_HEAD(&mm->ml_entry);
272 INIT_LIST_HEAD(&mm->fl_entry); 272 INIT_LIST_HEAD(&mm->fl_entry);
@@ -275,12 +275,12 @@ int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size)
275} 275}
276 276
277 277
278void drm_mm_takedown(drm_mm_t * mm) 278void drm_mm_takedown(struct drm_mm * mm)
279{ 279{
280 struct list_head *bnode = mm->fl_entry.next; 280 struct list_head *bnode = mm->fl_entry.next;
281 drm_mm_node_t *entry; 281 struct drm_mm_node *entry;
282 282
283 entry = list_entry(bnode, drm_mm_node_t, fl_entry); 283 entry = list_entry(bnode, struct drm_mm_node, fl_entry);
284 284
285 if (entry->ml_entry.next != &mm->ml_entry || 285 if (entry->ml_entry.next != &mm->ml_entry ||
286 entry->fl_entry.next != &mm->fl_entry) { 286 entry->fl_entry.next != &mm->fl_entry) {