diff options
Diffstat (limited to 'drivers/char/drm/radeon_mem.c')
-rw-r--r-- | drivers/char/drm/radeon_mem.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c index df5b2e0bea33..966d521cf27c 100644 --- a/drivers/char/drm/radeon_mem.c +++ b/drivers/char/drm/radeon_mem.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | static struct mem_block *split_block(struct mem_block *p, int start, int size, | 41 | static struct mem_block *split_block(struct mem_block *p, int start, int size, |
42 | DRMFILE filp) | 42 | struct drm_file *file_priv) |
43 | { | 43 | { |
44 | /* Maybe cut off the start of an existing block */ | 44 | /* Maybe cut off the start of an existing block */ |
45 | if (start > p->start) { | 45 | if (start > p->start) { |
@@ -49,7 +49,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size, | |||
49 | goto out; | 49 | goto out; |
50 | newblock->start = start; | 50 | newblock->start = start; |
51 | newblock->size = p->size - (start - p->start); | 51 | newblock->size = p->size - (start - p->start); |
52 | newblock->filp = NULL; | 52 | newblock->file_priv = NULL; |
53 | newblock->next = p->next; | 53 | newblock->next = p->next; |
54 | newblock->prev = p; | 54 | newblock->prev = p; |
55 | p->next->prev = newblock; | 55 | p->next->prev = newblock; |
@@ -66,7 +66,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size, | |||
66 | goto out; | 66 | goto out; |
67 | newblock->start = start + size; | 67 | newblock->start = start + size; |
68 | newblock->size = p->size - size; | 68 | newblock->size = p->size - size; |
69 | newblock->filp = NULL; | 69 | newblock->file_priv = NULL; |
70 | newblock->next = p->next; | 70 | newblock->next = p->next; |
71 | newblock->prev = p; | 71 | newblock->prev = p; |
72 | p->next->prev = newblock; | 72 | p->next->prev = newblock; |
@@ -76,20 +76,20 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size, | |||
76 | 76 | ||
77 | out: | 77 | out: |
78 | /* Our block is in the middle */ | 78 | /* Our block is in the middle */ |
79 | p->filp = filp; | 79 | p->file_priv = file_priv; |
80 | return p; | 80 | return p; |
81 | } | 81 | } |
82 | 82 | ||
83 | static struct mem_block *alloc_block(struct mem_block *heap, int size, | 83 | static struct mem_block *alloc_block(struct mem_block *heap, int size, |
84 | int align2, DRMFILE filp) | 84 | int align2, struct drm_file *file_priv) |
85 | { | 85 | { |
86 | struct mem_block *p; | 86 | struct mem_block *p; |
87 | int mask = (1 << align2) - 1; | 87 | int mask = (1 << align2) - 1; |
88 | 88 | ||
89 | list_for_each(p, heap) { | 89 | list_for_each(p, heap) { |
90 | int start = (p->start + mask) & ~mask; | 90 | int start = (p->start + mask) & ~mask; |
91 | if (p->filp == 0 && start + size <= p->start + p->size) | 91 | if (p->file_priv == 0 && start + size <= p->start + p->size) |
92 | return split_block(p, start, size, filp); | 92 | return split_block(p, start, size, file_priv); |
93 | } | 93 | } |
94 | 94 | ||
95 | return NULL; | 95 | return NULL; |
@@ -108,12 +108,12 @@ static struct mem_block *find_block(struct mem_block *heap, int start) | |||
108 | 108 | ||
109 | static void free_block(struct mem_block *p) | 109 | static void free_block(struct mem_block *p) |
110 | { | 110 | { |
111 | p->filp = NULL; | 111 | p->file_priv = NULL; |
112 | 112 | ||
113 | /* Assumes a single contiguous range. Needs a special filp in | 113 | /* Assumes a single contiguous range. Needs a special file_priv in |
114 | * 'heap' to stop it being subsumed. | 114 | * 'heap' to stop it being subsumed. |
115 | */ | 115 | */ |
116 | if (p->next->filp == 0) { | 116 | if (p->next->file_priv == 0) { |
117 | struct mem_block *q = p->next; | 117 | struct mem_block *q = p->next; |
118 | p->size += q->size; | 118 | p->size += q->size; |
119 | p->next = q->next; | 119 | p->next = q->next; |
@@ -121,7 +121,7 @@ static void free_block(struct mem_block *p) | |||
121 | drm_free(q, sizeof(*q), DRM_MEM_BUFS); | 121 | drm_free(q, sizeof(*q), DRM_MEM_BUFS); |
122 | } | 122 | } |
123 | 123 | ||
124 | if (p->prev->filp == 0) { | 124 | if (p->prev->file_priv == 0) { |
125 | struct mem_block *q = p->prev; | 125 | struct mem_block *q = p->prev; |
126 | q->size += p->size; | 126 | q->size += p->size; |
127 | q->next = p->next; | 127 | q->next = p->next; |
@@ -147,18 +147,18 @@ static int init_heap(struct mem_block **heap, int start, int size) | |||
147 | 147 | ||
148 | blocks->start = start; | 148 | blocks->start = start; |
149 | blocks->size = size; | 149 | blocks->size = size; |
150 | blocks->filp = NULL; | 150 | blocks->file_priv = NULL; |
151 | blocks->next = blocks->prev = *heap; | 151 | blocks->next = blocks->prev = *heap; |
152 | 152 | ||
153 | memset(*heap, 0, sizeof(**heap)); | 153 | memset(*heap, 0, sizeof(**heap)); |
154 | (*heap)->filp = (DRMFILE) - 1; | 154 | (*heap)->file_priv = (struct drm_file *) - 1; |
155 | (*heap)->next = (*heap)->prev = blocks; | 155 | (*heap)->next = (*heap)->prev = blocks; |
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | /* Free all blocks associated with the releasing file. | 159 | /* Free all blocks associated with the releasing file. |
160 | */ | 160 | */ |
161 | void radeon_mem_release(DRMFILE filp, struct mem_block *heap) | 161 | void radeon_mem_release(struct drm_file *file_priv, struct mem_block *heap) |
162 | { | 162 | { |
163 | struct mem_block *p; | 163 | struct mem_block *p; |
164 | 164 | ||
@@ -166,15 +166,15 @@ void radeon_mem_release(DRMFILE filp, struct mem_block *heap) | |||
166 | return; | 166 | return; |
167 | 167 | ||
168 | list_for_each(p, heap) { | 168 | list_for_each(p, heap) { |
169 | if (p->filp == filp) | 169 | if (p->file_priv == file_priv) |
170 | p->filp = NULL; | 170 | p->file_priv = NULL; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* Assumes a single contiguous range. Needs a special filp in | 173 | /* Assumes a single contiguous range. Needs a special file_priv in |
174 | * 'heap' to stop it being subsumed. | 174 | * 'heap' to stop it being subsumed. |
175 | */ | 175 | */ |
176 | list_for_each(p, heap) { | 176 | list_for_each(p, heap) { |
177 | while (p->filp == 0 && p->next->filp == 0) { | 177 | while (p->file_priv == 0 && p->next->file_priv == 0) { |
178 | struct mem_block *q = p->next; | 178 | struct mem_block *q = p->next; |
179 | p->size += q->size; | 179 | p->size += q->size; |
180 | p->next = q->next; | 180 | p->next = q->next; |
@@ -242,7 +242,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS) | |||
242 | if (alloc.alignment < 12) | 242 | if (alloc.alignment < 12) |
243 | alloc.alignment = 12; | 243 | alloc.alignment = 12; |
244 | 244 | ||
245 | block = alloc_block(*heap, alloc.size, alloc.alignment, filp); | 245 | block = alloc_block(*heap, alloc.size, alloc.alignment, file_priv); |
246 | 246 | ||
247 | if (!block) | 247 | if (!block) |
248 | return -ENOMEM; | 248 | return -ENOMEM; |
@@ -278,7 +278,7 @@ int radeon_mem_free(DRM_IOCTL_ARGS) | |||
278 | if (!block) | 278 | if (!block) |
279 | return -EFAULT; | 279 | return -EFAULT; |
280 | 280 | ||
281 | if (block->filp != filp) | 281 | if (block->file_priv != file_priv) |
282 | return -EPERM; | 282 | return -EPERM; |
283 | 283 | ||
284 | free_block(block); | 284 | free_block(block); |