diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2005-09-25 00:28:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2005-09-25 00:28:13 -0400 |
commit | b5e89ed53ed8d24f83ba1941c07382af00ed238e (patch) | |
tree | 747bae7a565f88a2e1d5974776eeb054a932c505 /drivers/char/drm/sis_mm.c | |
parent | 99a2657a29e2d623c3568cd86b27cac13fb63140 (diff) |
drm: lindent the drm directory.
I've been threatening this for a while, so no point hanging around.
This lindents the DRM code which was always really bad in tabbing department.
I've also fixed some misnamed files in comments and removed some trailing
whitespace.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/sis_mm.c')
-rw-r--r-- | drivers/char/drm/sis_mm.c | 132 |
1 files changed, 67 insertions, 65 deletions
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c index 6610c5576d22..50e32384ad93 100644 --- a/drivers/char/drm/sis_mm.c +++ b/drivers/char/drm/sis_mm.c | |||
@@ -10,11 +10,11 @@ | |||
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
11 | * and/or sell copies of the Software, and to permit persons to whom the | 11 | * and/or sell copies of the Software, and to permit persons to whom the |
12 | * Software is furnished to do so, subject to the following conditions: | 12 | * Software is furnished to do so, subject to the following conditions: |
13 | * | 13 | * |
14 | * The above copyright notice and this permission notice (including the next | 14 | * The above copyright notice and this permission notice (including the next |
15 | * paragraph) shall be included in all copies or substantial portions of the | 15 | * paragraph) shall be included in all copies or substantial portions of the |
16 | * Software. | 16 | * Software. |
17 | * | 17 | * |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
@@ -22,10 +22,10 @@ | |||
22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 22 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
24 | * DEALINGS IN THE SOFTWARE. | 24 | * DEALINGS IN THE SOFTWARE. |
25 | * | 25 | * |
26 | * Authors: | 26 | * Authors: |
27 | * Sung-Ching Lin <sclin@sis.com.tw> | 27 | * Sung-Ching Lin <sclin@sis.com.tw> |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "drmP.h" | 31 | #include "drmP.h" |
@@ -37,25 +37,23 @@ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define MAX_CONTEXT 100 | 39 | #define MAX_CONTEXT 100 |
40 | #define VIDEO_TYPE 0 | 40 | #define VIDEO_TYPE 0 |
41 | #define AGP_TYPE 1 | 41 | #define AGP_TYPE 1 |
42 | 42 | ||
43 | typedef struct { | 43 | typedef struct { |
44 | int used; | 44 | int used; |
45 | int context; | 45 | int context; |
46 | set_t *sets[2]; /* 0 for video, 1 for AGP */ | 46 | set_t *sets[2]; /* 0 for video, 1 for AGP */ |
47 | } sis_context_t; | 47 | } sis_context_t; |
48 | 48 | ||
49 | static sis_context_t global_ppriv[MAX_CONTEXT]; | 49 | static sis_context_t global_ppriv[MAX_CONTEXT]; |
50 | 50 | ||
51 | |||
52 | static int add_alloc_set(int context, int type, unsigned int val) | 51 | static int add_alloc_set(int context, int type, unsigned int val) |
53 | { | 52 | { |
54 | int i, retval = 0; | 53 | int i, retval = 0; |
55 | 54 | ||
56 | for (i = 0; i < MAX_CONTEXT; i++) { | 55 | for (i = 0; i < MAX_CONTEXT; i++) { |
57 | if (global_ppriv[i].used && global_ppriv[i].context == context) | 56 | if (global_ppriv[i].used && global_ppriv[i].context == context) { |
58 | { | ||
59 | retval = setAdd(global_ppriv[i].sets[type], val); | 57 | retval = setAdd(global_ppriv[i].sets[type], val); |
60 | break; | 58 | break; |
61 | } | 59 | } |
@@ -64,12 +62,11 @@ static int add_alloc_set(int context, int type, unsigned int val) | |||
64 | } | 62 | } |
65 | 63 | ||
66 | static int del_alloc_set(int context, int type, unsigned int val) | 64 | static int del_alloc_set(int context, int type, unsigned int val) |
67 | { | 65 | { |
68 | int i, retval = 0; | 66 | int i, retval = 0; |
69 | 67 | ||
70 | for (i = 0; i < MAX_CONTEXT; i++) { | 68 | for (i = 0; i < MAX_CONTEXT; i++) { |
71 | if (global_ppriv[i].used && global_ppriv[i].context == context) | 69 | if (global_ppriv[i].used && global_ppriv[i].context == context) { |
72 | { | ||
73 | retval = setDel(global_ppriv[i].sets[type], val); | 70 | retval = setDel(global_ppriv[i].sets[type], val); |
74 | break; | 71 | break; |
75 | } | 72 | } |
@@ -77,15 +74,15 @@ static int del_alloc_set(int context, int type, unsigned int val) | |||
77 | return retval; | 74 | return retval; |
78 | } | 75 | } |
79 | 76 | ||
80 | /* fb management via fb device */ | 77 | /* fb management via fb device */ |
81 | #if defined(__linux__) && defined(CONFIG_FB_SIS) | 78 | #if defined(__linux__) && defined(CONFIG_FB_SIS) |
82 | 79 | ||
83 | static int sis_fb_init( DRM_IOCTL_ARGS ) | 80 | static int sis_fb_init(DRM_IOCTL_ARGS) |
84 | { | 81 | { |
85 | return 0; | 82 | return 0; |
86 | } | 83 | } |
87 | 84 | ||
88 | static int sis_fb_alloc( DRM_IOCTL_ARGS ) | 85 | static int sis_fb_alloc(DRM_IOCTL_ARGS) |
89 | { | 86 | { |
90 | drm_sis_mem_t fb; | 87 | drm_sis_mem_t fb; |
91 | struct sis_memreq req; | 88 | struct sis_memreq req; |
@@ -105,7 +102,7 @@ static int sis_fb_alloc( DRM_IOCTL_ARGS ) | |||
105 | sis_free(req.offset); | 102 | sis_free(req.offset); |
106 | retval = DRM_ERR(EINVAL); | 103 | retval = DRM_ERR(EINVAL); |
107 | } | 104 | } |
108 | } else { | 105 | } else { |
109 | fb.offset = 0; | 106 | fb.offset = 0; |
110 | fb.size = 0; | 107 | fb.size = 0; |
111 | fb.free = 0; | 108 | fb.free = 0; |
@@ -118,19 +115,19 @@ static int sis_fb_alloc( DRM_IOCTL_ARGS ) | |||
118 | return retval; | 115 | return retval; |
119 | } | 116 | } |
120 | 117 | ||
121 | static int sis_fb_free( DRM_IOCTL_ARGS ) | 118 | static int sis_fb_free(DRM_IOCTL_ARGS) |
122 | { | 119 | { |
123 | drm_sis_mem_t fb; | 120 | drm_sis_mem_t fb; |
124 | int retval = 0; | 121 | int retval = 0; |
125 | 122 | ||
126 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *)data, sizeof(fb)); | 123 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *) data, sizeof(fb)); |
127 | 124 | ||
128 | if (!fb.free) | 125 | if (!fb.free) |
129 | return DRM_ERR(EINVAL); | 126 | return DRM_ERR(EINVAL); |
130 | 127 | ||
131 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) | 128 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) |
132 | retval = DRM_ERR(EINVAL); | 129 | retval = DRM_ERR(EINVAL); |
133 | sis_free((u32)fb.free); | 130 | sis_free((u32) fb.free); |
134 | 131 | ||
135 | DRM_DEBUG("free fb, offset = %lu\n", fb.free); | 132 | DRM_DEBUG("free fb, offset = %lu\n", fb.free); |
136 | 133 | ||
@@ -149,17 +146,17 @@ static int sis_fb_free( DRM_IOCTL_ARGS ) | |||
149 | * X driver/sisfb HW- Command- | 146 | * X driver/sisfb HW- Command- |
150 | * framebuffer memory DRI heap Cursor queue | 147 | * framebuffer memory DRI heap Cursor queue |
151 | */ | 148 | */ |
152 | static int sis_fb_init( DRM_IOCTL_ARGS ) | 149 | static int sis_fb_init(DRM_IOCTL_ARGS) |
153 | { | 150 | { |
154 | DRM_DEVICE; | 151 | DRM_DEVICE; |
155 | drm_sis_private_t *dev_priv = dev->dev_private; | 152 | drm_sis_private_t *dev_priv = dev->dev_private; |
156 | drm_sis_fb_t fb; | 153 | drm_sis_fb_t fb; |
157 | 154 | ||
158 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t __user *)data, sizeof(fb)); | 155 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t __user *) data, sizeof(fb)); |
159 | 156 | ||
160 | if (dev_priv == NULL) { | 157 | if (dev_priv == NULL) { |
161 | dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), | 158 | dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), |
162 | DRM_MEM_DRIVER); | 159 | DRM_MEM_DRIVER); |
163 | dev_priv = dev->dev_private; | 160 | dev_priv = dev->dev_private; |
164 | if (dev_priv == NULL) | 161 | if (dev_priv == NULL) |
165 | return ENOMEM; | 162 | return ENOMEM; |
@@ -175,7 +172,7 @@ static int sis_fb_init( DRM_IOCTL_ARGS ) | |||
175 | return 0; | 172 | return 0; |
176 | } | 173 | } |
177 | 174 | ||
178 | static int sis_fb_alloc( DRM_IOCTL_ARGS ) | 175 | static int sis_fb_alloc(DRM_IOCTL_ARGS) |
179 | { | 176 | { |
180 | DRM_DEVICE; | 177 | DRM_DEVICE; |
181 | drm_sis_private_t *dev_priv = dev->dev_private; | 178 | drm_sis_private_t *dev_priv = dev->dev_private; |
@@ -186,9 +183,9 @@ static int sis_fb_alloc( DRM_IOCTL_ARGS ) | |||
186 | 183 | ||
187 | if (dev_priv == NULL || dev_priv->FBHeap == NULL) | 184 | if (dev_priv == NULL || dev_priv->FBHeap == NULL) |
188 | return DRM_ERR(EINVAL); | 185 | return DRM_ERR(EINVAL); |
189 | 186 | ||
190 | DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb)); | 187 | DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb)); |
191 | 188 | ||
192 | block = mmAllocMem(dev_priv->FBHeap, fb.size, 0, 0); | 189 | block = mmAllocMem(dev_priv->FBHeap, fb.size, 0, 0); |
193 | if (block) { | 190 | if (block) { |
194 | /* TODO */ | 191 | /* TODO */ |
@@ -196,7 +193,7 @@ static int sis_fb_alloc( DRM_IOCTL_ARGS ) | |||
196 | fb.free = (unsigned long)block; | 193 | fb.free = (unsigned long)block; |
197 | if (!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)) { | 194 | if (!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)) { |
198 | DRM_DEBUG("adding to allocation set fails\n"); | 195 | DRM_DEBUG("adding to allocation set fails\n"); |
199 | mmFreeMem((PMemBlock)fb.free); | 196 | mmFreeMem((PMemBlock) fb.free); |
200 | retval = DRM_ERR(EINVAL); | 197 | retval = DRM_ERR(EINVAL); |
201 | } | 198 | } |
202 | } else { | 199 | } else { |
@@ -212,7 +209,7 @@ static int sis_fb_alloc( DRM_IOCTL_ARGS ) | |||
212 | return retval; | 209 | return retval; |
213 | } | 210 | } |
214 | 211 | ||
215 | static int sis_fb_free( DRM_IOCTL_ARGS ) | 212 | static int sis_fb_free(DRM_IOCTL_ARGS) |
216 | { | 213 | { |
217 | DRM_DEVICE; | 214 | DRM_DEVICE; |
218 | drm_sis_private_t *dev_priv = dev->dev_private; | 215 | drm_sis_private_t *dev_priv = dev->dev_private; |
@@ -221,14 +218,14 @@ static int sis_fb_free( DRM_IOCTL_ARGS ) | |||
221 | if (dev_priv == NULL || dev_priv->FBHeap == NULL) | 218 | if (dev_priv == NULL || dev_priv->FBHeap == NULL) |
222 | return DRM_ERR(EINVAL); | 219 | return DRM_ERR(EINVAL); |
223 | 220 | ||
224 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *)data, sizeof(fb)); | 221 | DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *) data, sizeof(fb)); |
225 | 222 | ||
226 | if (!mmBlockInHeap(dev_priv->FBHeap, (PMemBlock)fb.free)) | 223 | if (!mmBlockInHeap(dev_priv->FBHeap, (PMemBlock) fb.free)) |
227 | return DRM_ERR(EINVAL); | 224 | return DRM_ERR(EINVAL); |
228 | 225 | ||
229 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) | 226 | if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) |
230 | return DRM_ERR(EINVAL); | 227 | return DRM_ERR(EINVAL); |
231 | mmFreeMem((PMemBlock)fb.free); | 228 | mmFreeMem((PMemBlock) fb.free); |
232 | 229 | ||
233 | DRM_DEBUG("free fb, free = 0x%lx\n", fb.free); | 230 | DRM_DEBUG("free fb, free = 0x%lx\n", fb.free); |
234 | 231 | ||
@@ -237,9 +234,9 @@ static int sis_fb_free( DRM_IOCTL_ARGS ) | |||
237 | 234 | ||
238 | #endif | 235 | #endif |
239 | 236 | ||
240 | /* agp memory management */ | 237 | /* agp memory management */ |
241 | 238 | ||
242 | static int sis_ioctl_agp_init( DRM_IOCTL_ARGS ) | 239 | static int sis_ioctl_agp_init(DRM_IOCTL_ARGS) |
243 | { | 240 | { |
244 | DRM_DEVICE; | 241 | DRM_DEVICE; |
245 | drm_sis_private_t *dev_priv = dev->dev_private; | 242 | drm_sis_private_t *dev_priv = dev->dev_private; |
@@ -247,7 +244,7 @@ static int sis_ioctl_agp_init( DRM_IOCTL_ARGS ) | |||
247 | 244 | ||
248 | if (dev_priv == NULL) { | 245 | if (dev_priv == NULL) { |
249 | dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), | 246 | dev->dev_private = drm_calloc(1, sizeof(drm_sis_private_t), |
250 | DRM_MEM_DRIVER); | 247 | DRM_MEM_DRIVER); |
251 | dev_priv = dev->dev_private; | 248 | dev_priv = dev->dev_private; |
252 | if (dev_priv == NULL) | 249 | if (dev_priv == NULL) |
253 | return ENOMEM; | 250 | return ENOMEM; |
@@ -256,16 +253,17 @@ static int sis_ioctl_agp_init( DRM_IOCTL_ARGS ) | |||
256 | if (dev_priv->AGPHeap != NULL) | 253 | if (dev_priv->AGPHeap != NULL) |
257 | return DRM_ERR(EINVAL); | 254 | return DRM_ERR(EINVAL); |
258 | 255 | ||
259 | DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_agp_t __user *)data, sizeof(agp)); | 256 | DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_agp_t __user *) data, |
257 | sizeof(agp)); | ||
260 | 258 | ||
261 | dev_priv->AGPHeap = mmInit(agp.offset, agp.size); | 259 | dev_priv->AGPHeap = mmInit(agp.offset, agp.size); |
262 | 260 | ||
263 | DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size); | 261 | DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size); |
264 | 262 | ||
265 | return 0; | 263 | return 0; |
266 | } | 264 | } |
267 | 265 | ||
268 | static int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS ) | 266 | static int sis_ioctl_agp_alloc(DRM_IOCTL_ARGS) |
269 | { | 267 | { |
270 | DRM_DEVICE; | 268 | DRM_DEVICE; |
271 | drm_sis_private_t *dev_priv = dev->dev_private; | 269 | drm_sis_private_t *dev_priv = dev->dev_private; |
@@ -273,12 +271,12 @@ static int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS ) | |||
273 | drm_sis_mem_t agp; | 271 | drm_sis_mem_t agp; |
274 | PMemBlock block; | 272 | PMemBlock block; |
275 | int retval = 0; | 273 | int retval = 0; |
276 | 274 | ||
277 | if (dev_priv == NULL || dev_priv->AGPHeap == NULL) | 275 | if (dev_priv == NULL || dev_priv->AGPHeap == NULL) |
278 | return DRM_ERR(EINVAL); | 276 | return DRM_ERR(EINVAL); |
279 | 277 | ||
280 | DRM_COPY_FROM_USER_IOCTL(agp, argp, sizeof(agp)); | 278 | DRM_COPY_FROM_USER_IOCTL(agp, argp, sizeof(agp)); |
281 | 279 | ||
282 | block = mmAllocMem(dev_priv->AGPHeap, agp.size, 0, 0); | 280 | block = mmAllocMem(dev_priv->AGPHeap, agp.size, 0, 0); |
283 | if (block) { | 281 | if (block) { |
284 | /* TODO */ | 282 | /* TODO */ |
@@ -286,10 +284,10 @@ static int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS ) | |||
286 | agp.free = (unsigned long)block; | 284 | agp.free = (unsigned long)block; |
287 | if (!add_alloc_set(agp.context, AGP_TYPE, agp.free)) { | 285 | if (!add_alloc_set(agp.context, AGP_TYPE, agp.free)) { |
288 | DRM_DEBUG("adding to allocation set fails\n"); | 286 | DRM_DEBUG("adding to allocation set fails\n"); |
289 | mmFreeMem((PMemBlock)agp.free); | 287 | mmFreeMem((PMemBlock) agp.free); |
290 | retval = -1; | 288 | retval = -1; |
291 | } | 289 | } |
292 | } else { | 290 | } else { |
293 | agp.offset = 0; | 291 | agp.offset = 0; |
294 | agp.size = 0; | 292 | agp.size = 0; |
295 | agp.free = 0; | 293 | agp.free = 0; |
@@ -302,7 +300,7 @@ static int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS ) | |||
302 | return retval; | 300 | return retval; |
303 | } | 301 | } |
304 | 302 | ||
305 | static int sis_ioctl_agp_free( DRM_IOCTL_ARGS ) | 303 | static int sis_ioctl_agp_free(DRM_IOCTL_ARGS) |
306 | { | 304 | { |
307 | DRM_DEVICE; | 305 | DRM_DEVICE; |
308 | drm_sis_private_t *dev_priv = dev->dev_private; | 306 | drm_sis_private_t *dev_priv = dev->dev_private; |
@@ -311,12 +309,13 @@ static int sis_ioctl_agp_free( DRM_IOCTL_ARGS ) | |||
311 | if (dev_priv == NULL || dev_priv->AGPHeap == NULL) | 309 | if (dev_priv == NULL || dev_priv->AGPHeap == NULL) |
312 | return DRM_ERR(EINVAL); | 310 | return DRM_ERR(EINVAL); |
313 | 311 | ||
314 | DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_mem_t __user *)data, sizeof(agp)); | 312 | DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_mem_t __user *) data, |
313 | sizeof(agp)); | ||
315 | 314 | ||
316 | if (!mmBlockInHeap(dev_priv->AGPHeap, (PMemBlock)agp.free)) | 315 | if (!mmBlockInHeap(dev_priv->AGPHeap, (PMemBlock) agp.free)) |
317 | return DRM_ERR(EINVAL); | 316 | return DRM_ERR(EINVAL); |
318 | 317 | ||
319 | mmFreeMem((PMemBlock)agp.free); | 318 | mmFreeMem((PMemBlock) agp.free); |
320 | if (!del_alloc_set(agp.context, AGP_TYPE, agp.free)) | 319 | if (!del_alloc_set(agp.context, AGP_TYPE, agp.free)) |
321 | return DRM_ERR(EINVAL); | 320 | return DRM_ERR(EINVAL); |
322 | 321 | ||
@@ -329,31 +328,30 @@ int sis_init_context(struct drm_device *dev, int context) | |||
329 | { | 328 | { |
330 | int i; | 329 | int i; |
331 | 330 | ||
332 | for (i = 0; i < MAX_CONTEXT ; i++) { | 331 | for (i = 0; i < MAX_CONTEXT; i++) { |
333 | if (global_ppriv[i].used && | 332 | if (global_ppriv[i].used && |
334 | (global_ppriv[i].context == context)) | 333 | (global_ppriv[i].context == context)) |
335 | break; | 334 | break; |
336 | } | 335 | } |
337 | 336 | ||
338 | if (i >= MAX_CONTEXT) { | 337 | if (i >= MAX_CONTEXT) { |
339 | for (i = 0; i < MAX_CONTEXT ; i++) { | 338 | for (i = 0; i < MAX_CONTEXT; i++) { |
340 | if (!global_ppriv[i].used) { | 339 | if (!global_ppriv[i].used) { |
341 | global_ppriv[i].context = context; | 340 | global_ppriv[i].context = context; |
342 | global_ppriv[i].used = 1; | 341 | global_ppriv[i].used = 1; |
343 | global_ppriv[i].sets[0] = setInit(); | 342 | global_ppriv[i].sets[0] = setInit(); |
344 | global_ppriv[i].sets[1] = setInit(); | 343 | global_ppriv[i].sets[1] = setInit(); |
345 | DRM_DEBUG("init allocation set, socket=%d, " | 344 | DRM_DEBUG("init allocation set, socket=%d, " |
346 | "context = %d\n", i, context); | 345 | "context = %d\n", i, context); |
347 | break; | 346 | break; |
348 | } | 347 | } |
349 | } | 348 | } |
350 | if ((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) || | 349 | if ((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) || |
351 | (global_ppriv[i].sets[1] == NULL)) | 350 | (global_ppriv[i].sets[1] == NULL)) { |
352 | { | ||
353 | return 0; | 351 | return 0; |
354 | } | 352 | } |
355 | } | 353 | } |
356 | 354 | ||
357 | return 1; | 355 | return 1; |
358 | } | 356 | } |
359 | 357 | ||
@@ -361,7 +359,7 @@ int sis_final_context(struct drm_device *dev, int context) | |||
361 | { | 359 | { |
362 | int i; | 360 | int i; |
363 | 361 | ||
364 | for (i=0; i<MAX_CONTEXT; i++) { | 362 | for (i = 0; i < MAX_CONTEXT; i++) { |
365 | if (global_ppriv[i].used && | 363 | if (global_ppriv[i].used && |
366 | (global_ppriv[i].context == context)) | 364 | (global_ppriv[i].context == context)) |
367 | break; | 365 | break; |
@@ -382,7 +380,7 @@ int sis_final_context(struct drm_device *dev, int context) | |||
382 | #if defined(__linux__) && defined(CONFIG_FB_SIS) | 380 | #if defined(__linux__) && defined(CONFIG_FB_SIS) |
383 | sis_free(item); | 381 | sis_free(item); |
384 | #else | 382 | #else |
385 | mmFreeMem((PMemBlock)item); | 383 | mmFreeMem((PMemBlock) item); |
386 | #endif | 384 | #endif |
387 | retval = setNext(set, &item); | 385 | retval = setNext(set, &item); |
388 | } | 386 | } |
@@ -393,25 +391,29 @@ int sis_final_context(struct drm_device *dev, int context) | |||
393 | retval = setFirst(set, &item); | 391 | retval = setFirst(set, &item); |
394 | while (retval) { | 392 | while (retval) { |
395 | DRM_DEBUG("free agp memory 0x%x\n", item); | 393 | DRM_DEBUG("free agp memory 0x%x\n", item); |
396 | mmFreeMem((PMemBlock)item); | 394 | mmFreeMem((PMemBlock) item); |
397 | retval = setNext(set, &item); | 395 | retval = setNext(set, &item); |
398 | } | 396 | } |
399 | setDestroy(set); | 397 | setDestroy(set); |
400 | 398 | ||
401 | global_ppriv[i].used = 0; | 399 | global_ppriv[i].used = 0; |
402 | } | 400 | } |
403 | 401 | ||
404 | return 1; | 402 | return 1; |
405 | } | 403 | } |
406 | 404 | ||
407 | drm_ioctl_desc_t sis_ioctls[] = { | 405 | drm_ioctl_desc_t sis_ioctls[] = { |
408 | [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = { sis_fb_alloc, 1, 0 }, | 406 | [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = {sis_fb_alloc, 1, 0} |
409 | [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = { sis_fb_free, 1, 0 }, | 407 | , |
410 | [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = { sis_ioctl_agp_init, 1, 1 }, | 408 | [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = {sis_fb_free, 1, 0} |
411 | [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = { sis_ioctl_agp_alloc, 1, 0 }, | 409 | , |
412 | [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = { sis_ioctl_agp_free, 1, 0 }, | 410 | [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = {sis_ioctl_agp_init, 1, 1} |
413 | [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = { sis_fb_init, 1, 1 } | 411 | , |
412 | [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = {sis_ioctl_agp_alloc, 1, 0} | ||
413 | , | ||
414 | [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = {sis_ioctl_agp_free, 1, 0} | ||
415 | , | ||
416 | [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, 1, 1} | ||
414 | }; | 417 | }; |
415 | 418 | ||
416 | int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls); | 419 | int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls); |
417 | |||