aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/i915_ioc32.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-09-25 00:28:13 -0400
committerDave Airlie <airlied@linux.ie>2005-09-25 00:28:13 -0400
commitb5e89ed53ed8d24f83ba1941c07382af00ed238e (patch)
tree747bae7a565f88a2e1d5974776eeb054a932c505 /drivers/char/drm/i915_ioc32.c
parent99a2657a29e2d623c3568cd86b27cac13fb63140 (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/i915_ioc32.c')
-rw-r--r--drivers/char/drm/i915_ioc32.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/char/drm/i915_ioc32.c b/drivers/char/drm/i915_ioc32.c
index fe009e1b3a3f..2218a946ec87 100644
--- a/drivers/char/drm/i915_ioc32.c
+++ b/drivers/char/drm/i915_ioc32.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * 32-bit ioctl compatibility routines for the i915 DRM. 4 * 32-bit ioctl compatibility routines for the i915 DRM.
5 * 5 *
6 * \author Alan Hourihane <alanh@fairlite.demon.co.uk> 6 * \author Alan Hourihane <alanh@fairlite.demon.co.uk>
7 * 7 *
8 * 8 *
9 * Copyright (C) Paul Mackerras 2005 9 * Copyright (C) Paul Mackerras 2005
@@ -42,51 +42,55 @@ typedef struct _drm_i915_batchbuffer32 {
42 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 42 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
43 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 43 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
44 int num_cliprects; /* mulitpass with multiple cliprects? */ 44 int num_cliprects; /* mulitpass with multiple cliprects? */
45 u32 cliprects; /* pointer to userspace cliprects */ 45 u32 cliprects; /* pointer to userspace cliprects */
46} drm_i915_batchbuffer32_t; 46} drm_i915_batchbuffer32_t;
47 47
48static int compat_i915_batchbuffer(struct file *file, unsigned int cmd, 48static int compat_i915_batchbuffer(struct file *file, unsigned int cmd,
49 unsigned long arg) 49 unsigned long arg)
50{ 50{
51 drm_i915_batchbuffer32_t batchbuffer32; 51 drm_i915_batchbuffer32_t batchbuffer32;
52 drm_i915_batchbuffer_t __user *batchbuffer; 52 drm_i915_batchbuffer_t __user *batchbuffer;
53 53
54 if (copy_from_user(&batchbuffer32, (void __user *)arg, sizeof(batchbuffer32))) 54 if (copy_from_user
55 (&batchbuffer32, (void __user *)arg, sizeof(batchbuffer32)))
55 return -EFAULT; 56 return -EFAULT;
56 57
57 batchbuffer = compat_alloc_user_space(sizeof(*batchbuffer)); 58 batchbuffer = compat_alloc_user_space(sizeof(*batchbuffer));
58 if (!access_ok(VERIFY_WRITE, batchbuffer, sizeof(*batchbuffer)) 59 if (!access_ok(VERIFY_WRITE, batchbuffer, sizeof(*batchbuffer))
59 || __put_user(batchbuffer32.start, &batchbuffer->start) 60 || __put_user(batchbuffer32.start, &batchbuffer->start)
60 || __put_user(batchbuffer32.used, &batchbuffer->used) 61 || __put_user(batchbuffer32.used, &batchbuffer->used)
61 || __put_user(batchbuffer32.DR1, &batchbuffer->DR1) 62 || __put_user(batchbuffer32.DR1, &batchbuffer->DR1)
62 || __put_user(batchbuffer32.DR4, &batchbuffer->DR4) 63 || __put_user(batchbuffer32.DR4, &batchbuffer->DR4)
63 || __put_user(batchbuffer32.num_cliprects, &batchbuffer->num_cliprects) 64 || __put_user(batchbuffer32.num_cliprects,
65 &batchbuffer->num_cliprects)
64 || __put_user((int __user *)(unsigned long)batchbuffer32.cliprects, 66 || __put_user((int __user *)(unsigned long)batchbuffer32.cliprects,
65 &batchbuffer->cliprects)) 67 &batchbuffer->cliprects))
66 return -EFAULT; 68 return -EFAULT;
67 69
68 return drm_ioctl(file->f_dentry->d_inode, file, 70 return drm_ioctl(file->f_dentry->d_inode, file,
69 DRM_IOCTL_I915_BATCHBUFFER, (unsigned long) batchbuffer); 71 DRM_IOCTL_I915_BATCHBUFFER,
72 (unsigned long)batchbuffer);
70} 73}
71 74
72typedef struct _drm_i915_cmdbuffer32 { 75typedef struct _drm_i915_cmdbuffer32 {
73 u32 buf; /* pointer to userspace command buffer */ 76 u32 buf; /* pointer to userspace command buffer */
74 int sz; /* nr bytes in buf */ 77 int sz; /* nr bytes in buf */
75 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 78 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
76 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 79 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
77 int num_cliprects; /* mulitpass with multiple cliprects? */ 80 int num_cliprects; /* mulitpass with multiple cliprects? */
78 u32 cliprects; /* pointer to userspace cliprects */ 81 u32 cliprects; /* pointer to userspace cliprects */
79} drm_i915_cmdbuffer32_t; 82} drm_i915_cmdbuffer32_t;
80 83
81static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd, 84static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd,
82 unsigned long arg) 85 unsigned long arg)
83{ 86{
84 drm_i915_cmdbuffer32_t cmdbuffer32; 87 drm_i915_cmdbuffer32_t cmdbuffer32;
85 drm_i915_cmdbuffer_t __user *cmdbuffer; 88 drm_i915_cmdbuffer_t __user *cmdbuffer;
86 89
87 if (copy_from_user(&cmdbuffer32, (void __user *)arg, sizeof(cmdbuffer32))) 90 if (copy_from_user
91 (&cmdbuffer32, (void __user *)arg, sizeof(cmdbuffer32)))
88 return -EFAULT; 92 return -EFAULT;
89 93
90 cmdbuffer = compat_alloc_user_space(sizeof(*cmdbuffer)); 94 cmdbuffer = compat_alloc_user_space(sizeof(*cmdbuffer));
91 if (!access_ok(VERIFY_WRITE, cmdbuffer, sizeof(*cmdbuffer)) 95 if (!access_ok(VERIFY_WRITE, cmdbuffer, sizeof(*cmdbuffer))
92 || __put_user((int __user *)(unsigned long)cmdbuffer32.buf, 96 || __put_user((int __user *)(unsigned long)cmdbuffer32.buf,
@@ -98,9 +102,9 @@ static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd,
98 || __put_user((int __user *)(unsigned long)cmdbuffer32.cliprects, 102 || __put_user((int __user *)(unsigned long)cmdbuffer32.cliprects,
99 &cmdbuffer->cliprects)) 103 &cmdbuffer->cliprects))
100 return -EFAULT; 104 return -EFAULT;
101 105
102 return drm_ioctl(file->f_dentry->d_inode, file, 106 return drm_ioctl(file->f_dentry->d_inode, file,
103 DRM_IOCTL_I915_CMDBUFFER, (unsigned long) cmdbuffer); 107 DRM_IOCTL_I915_CMDBUFFER, (unsigned long)cmdbuffer);
104} 108}
105 109
106typedef struct drm_i915_irq_emit32 { 110typedef struct drm_i915_irq_emit32 {
@@ -108,12 +112,12 @@ typedef struct drm_i915_irq_emit32 {
108} drm_i915_irq_emit32_t; 112} drm_i915_irq_emit32_t;
109 113
110static int compat_i915_irq_emit(struct file *file, unsigned int cmd, 114static int compat_i915_irq_emit(struct file *file, unsigned int cmd,
111 unsigned long arg) 115 unsigned long arg)
112{ 116{
113 drm_i915_irq_emit32_t req32; 117 drm_i915_irq_emit32_t req32;
114 drm_i915_irq_emit_t __user *request; 118 drm_i915_irq_emit_t __user *request;
115 119
116 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 120 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
117 return -EFAULT; 121 return -EFAULT;
118 122
119 request = compat_alloc_user_space(sizeof(*request)); 123 request = compat_alloc_user_space(sizeof(*request));
@@ -123,7 +127,7 @@ static int compat_i915_irq_emit(struct file *file, unsigned int cmd,
123 return -EFAULT; 127 return -EFAULT;
124 128
125 return drm_ioctl(file->f_dentry->d_inode, file, 129 return drm_ioctl(file->f_dentry->d_inode, file,
126 DRM_IOCTL_I915_IRQ_EMIT, (unsigned long) request); 130 DRM_IOCTL_I915_IRQ_EMIT, (unsigned long)request);
127} 131}
128typedef struct drm_i915_getparam32 { 132typedef struct drm_i915_getparam32 {
129 int param; 133 int param;
@@ -131,12 +135,12 @@ typedef struct drm_i915_getparam32 {
131} drm_i915_getparam32_t; 135} drm_i915_getparam32_t;
132 136
133static int compat_i915_getparam(struct file *file, unsigned int cmd, 137static int compat_i915_getparam(struct file *file, unsigned int cmd,
134 unsigned long arg) 138 unsigned long arg)
135{ 139{
136 drm_i915_getparam32_t req32; 140 drm_i915_getparam32_t req32;
137 drm_i915_getparam_t __user *request; 141 drm_i915_getparam_t __user *request;
138 142
139 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 143 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
140 return -EFAULT; 144 return -EFAULT;
141 145
142 request = compat_alloc_user_space(sizeof(*request)); 146 request = compat_alloc_user_space(sizeof(*request));
@@ -147,7 +151,7 @@ static int compat_i915_getparam(struct file *file, unsigned int cmd,
147 return -EFAULT; 151 return -EFAULT;
148 152
149 return drm_ioctl(file->f_dentry->d_inode, file, 153 return drm_ioctl(file->f_dentry->d_inode, file,
150 DRM_IOCTL_I915_GETPARAM, (unsigned long) request); 154 DRM_IOCTL_I915_GETPARAM, (unsigned long)request);
151} 155}
152 156
153typedef struct drm_i915_mem_alloc32 { 157typedef struct drm_i915_mem_alloc32 {
@@ -158,12 +162,12 @@ typedef struct drm_i915_mem_alloc32 {
158} drm_i915_mem_alloc32_t; 162} drm_i915_mem_alloc32_t;
159 163
160static int compat_i915_alloc(struct file *file, unsigned int cmd, 164static int compat_i915_alloc(struct file *file, unsigned int cmd,
161 unsigned long arg) 165 unsigned long arg)
162{ 166{
163 drm_i915_mem_alloc32_t req32; 167 drm_i915_mem_alloc32_t req32;
164 drm_i915_mem_alloc_t __user *request; 168 drm_i915_mem_alloc_t __user *request;
165 169
166 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 170 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
167 return -EFAULT; 171 return -EFAULT;
168 172
169 request = compat_alloc_user_space(sizeof(*request)); 173 request = compat_alloc_user_space(sizeof(*request));
@@ -176,10 +180,9 @@ static int compat_i915_alloc(struct file *file, unsigned int cmd,
176 return -EFAULT; 180 return -EFAULT;
177 181
178 return drm_ioctl(file->f_dentry->d_inode, file, 182 return drm_ioctl(file->f_dentry->d_inode, file,
179 DRM_IOCTL_I915_ALLOC, (unsigned long) request); 183 DRM_IOCTL_I915_ALLOC, (unsigned long)request);
180} 184}
181 185
182
183drm_ioctl_compat_t *i915_compat_ioctls[] = { 186drm_ioctl_compat_t *i915_compat_ioctls[] = {
184 [DRM_I915_BATCHBUFFER] = compat_i915_batchbuffer, 187 [DRM_I915_BATCHBUFFER] = compat_i915_batchbuffer,
185 [DRM_I915_CMDBUFFER] = compat_i915_cmdbuffer, 188 [DRM_I915_CMDBUFFER] = compat_i915_cmdbuffer,
@@ -197,8 +200,7 @@ drm_ioctl_compat_t *i915_compat_ioctls[] = {
197 * \param arg user argument. 200 * \param arg user argument.
198 * \return zero on success or negative number on failure. 201 * \return zero on success or negative number on failure.
199 */ 202 */
200long i915_compat_ioctl(struct file *filp, unsigned int cmd, 203long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
201 unsigned long arg)
202{ 204{
203 unsigned int nr = DRM_IOCTL_NR(cmd); 205 unsigned int nr = DRM_IOCTL_NR(cmd);
204 drm_ioctl_compat_t *fn = NULL; 206 drm_ioctl_compat_t *fn = NULL;
@@ -206,13 +208,13 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd,
206 208
207 if (nr < DRM_COMMAND_BASE) 209 if (nr < DRM_COMMAND_BASE)
208 return drm_compat_ioctl(filp, cmd, arg); 210 return drm_compat_ioctl(filp, cmd, arg);
209 211
210 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls)) 212 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls))
211 fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE]; 213 fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE];
212 214
213 lock_kernel(); /* XXX for now */ 215 lock_kernel(); /* XXX for now */
214 if (fn != NULL) 216 if (fn != NULL)
215 ret = (*fn)(filp, cmd, arg); 217 ret = (*fn) (filp, cmd, arg);
216 else 218 else
217 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); 219 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
218 unlock_kernel(); 220 unlock_kernel();