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/mga_ioc32.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/mga_ioc32.c')
-rw-r--r-- | drivers/char/drm/mga_ioc32.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/drivers/char/drm/mga_ioc32.c b/drivers/char/drm/mga_ioc32.c index 77d738e75a4d..24a9d4e86af0 100644 --- a/drivers/char/drm/mga_ioc32.c +++ b/drivers/char/drm/mga_ioc32.c | |||
@@ -39,17 +39,17 @@ | |||
39 | 39 | ||
40 | typedef struct drm32_mga_init { | 40 | typedef struct drm32_mga_init { |
41 | int func; | 41 | int func; |
42 | u32 sarea_priv_offset; | 42 | u32 sarea_priv_offset; |
43 | int chipset; | 43 | int chipset; |
44 | int sgram; | 44 | int sgram; |
45 | unsigned int maccess; | 45 | unsigned int maccess; |
46 | unsigned int fb_cpp; | 46 | unsigned int fb_cpp; |
47 | unsigned int front_offset, front_pitch; | 47 | unsigned int front_offset, front_pitch; |
48 | unsigned int back_offset, back_pitch; | 48 | unsigned int back_offset, back_pitch; |
49 | unsigned int depth_cpp; | 49 | unsigned int depth_cpp; |
50 | unsigned int depth_offset, depth_pitch; | 50 | unsigned int depth_offset, depth_pitch; |
51 | unsigned int texture_offset[MGA_NR_TEX_HEAPS]; | 51 | unsigned int texture_offset[MGA_NR_TEX_HEAPS]; |
52 | unsigned int texture_size[MGA_NR_TEX_HEAPS]; | 52 | unsigned int texture_size[MGA_NR_TEX_HEAPS]; |
53 | u32 fb_offset; | 53 | u32 fb_offset; |
54 | u32 mmio_offset; | 54 | u32 mmio_offset; |
55 | u32 status_offset; | 55 | u32 status_offset; |
@@ -64,10 +64,10 @@ static int compat_mga_init(struct file *file, unsigned int cmd, | |||
64 | drm_mga_init32_t init32; | 64 | drm_mga_init32_t init32; |
65 | drm_mga_init_t __user *init; | 65 | drm_mga_init_t __user *init; |
66 | int err = 0, i; | 66 | int err = 0, i; |
67 | 67 | ||
68 | if (copy_from_user(&init32, (void __user *)arg, sizeof(init32))) | 68 | if (copy_from_user(&init32, (void __user *)arg, sizeof(init32))) |
69 | return -EFAULT; | 69 | return -EFAULT; |
70 | 70 | ||
71 | init = compat_alloc_user_space(sizeof(*init)); | 71 | init = compat_alloc_user_space(sizeof(*init)); |
72 | if (!access_ok(VERIFY_WRITE, init, sizeof(*init)) | 72 | if (!access_ok(VERIFY_WRITE, init, sizeof(*init)) |
73 | || __put_user(init32.func, &init->func) | 73 | || __put_user(init32.func, &init->func) |
@@ -90,42 +90,43 @@ static int compat_mga_init(struct file *file, unsigned int cmd, | |||
90 | || __put_user(init32.primary_offset, &init->primary_offset) | 90 | || __put_user(init32.primary_offset, &init->primary_offset) |
91 | || __put_user(init32.buffers_offset, &init->buffers_offset)) | 91 | || __put_user(init32.buffers_offset, &init->buffers_offset)) |
92 | return -EFAULT; | 92 | return -EFAULT; |
93 | 93 | ||
94 | for (i=0; i<MGA_NR_TEX_HEAPS; i++) | 94 | for (i = 0; i < MGA_NR_TEX_HEAPS; i++) { |
95 | { | 95 | err |= |
96 | err |= __put_user(init32.texture_offset[i], &init->texture_offset[i]); | 96 | __put_user(init32.texture_offset[i], |
97 | err |= __put_user(init32.texture_size[i], &init->texture_size[i]); | 97 | &init->texture_offset[i]); |
98 | err |= | ||
99 | __put_user(init32.texture_size[i], &init->texture_size[i]); | ||
98 | } | 100 | } |
99 | if (err) | 101 | if (err) |
100 | return -EFAULT; | 102 | return -EFAULT; |
101 | 103 | ||
102 | return drm_ioctl(file->f_dentry->d_inode, file, | 104 | return drm_ioctl(file->f_dentry->d_inode, file, |
103 | DRM_IOCTL_MGA_INIT, (unsigned long) init); | 105 | DRM_IOCTL_MGA_INIT, (unsigned long)init); |
104 | } | 106 | } |
105 | 107 | ||
106 | |||
107 | typedef struct drm_mga_getparam32 { | 108 | typedef struct drm_mga_getparam32 { |
108 | int param; | 109 | int param; |
109 | u32 value; | 110 | u32 value; |
110 | } drm_mga_getparam32_t; | 111 | } drm_mga_getparam32_t; |
111 | 112 | ||
112 | |||
113 | static int compat_mga_getparam(struct file *file, unsigned int cmd, | 113 | static int compat_mga_getparam(struct file *file, unsigned int cmd, |
114 | unsigned long arg) | 114 | unsigned long arg) |
115 | { | 115 | { |
116 | drm_mga_getparam32_t getparam32; | 116 | drm_mga_getparam32_t getparam32; |
117 | drm_mga_getparam_t __user *getparam; | 117 | drm_mga_getparam_t __user *getparam; |
118 | 118 | ||
119 | if (copy_from_user(&getparam32, (void __user *)arg, sizeof(getparam32))) | 119 | if (copy_from_user(&getparam32, (void __user *)arg, sizeof(getparam32))) |
120 | return -EFAULT; | 120 | return -EFAULT; |
121 | 121 | ||
122 | getparam = compat_alloc_user_space(sizeof(*getparam)); | 122 | getparam = compat_alloc_user_space(sizeof(*getparam)); |
123 | if (!access_ok(VERIFY_WRITE, getparam, sizeof(*getparam)) | 123 | if (!access_ok(VERIFY_WRITE, getparam, sizeof(*getparam)) |
124 | || __put_user(getparam32.param, &getparam->param) | 124 | || __put_user(getparam32.param, &getparam->param) |
125 | || __put_user((void __user *)(unsigned long)getparam32.value, &getparam->value)) | 125 | || __put_user((void __user *)(unsigned long)getparam32.value, |
126 | &getparam->value)) | ||
126 | return -EFAULT; | 127 | return -EFAULT; |
127 | 128 | ||
128 | return drm_ioctl(file->f_dentry->d_inode, file, | 129 | return drm_ioctl(file->f_dentry->d_inode, file, |
129 | DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); | 130 | DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); |
130 | } | 131 | } |
131 | 132 | ||
@@ -182,14 +183,12 @@ static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd, | |||
182 | &dma_bootstrap->secondary_bin_count) | 183 | &dma_bootstrap->secondary_bin_count) |
183 | || __get_user(dma_bootstrap32.secondary_bin_size, | 184 | || __get_user(dma_bootstrap32.secondary_bin_size, |
184 | &dma_bootstrap->secondary_bin_size) | 185 | &dma_bootstrap->secondary_bin_size) |
185 | || __get_user(dma_bootstrap32.agp_mode, | 186 | || __get_user(dma_bootstrap32.agp_mode, &dma_bootstrap->agp_mode) |
186 | &dma_bootstrap->agp_mode) | 187 | || __get_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) |
187 | || __get_user(dma_bootstrap32.agp_size, | ||
188 | &dma_bootstrap->agp_size)) | ||
189 | return -EFAULT; | 188 | return -EFAULT; |
190 | 189 | ||
191 | if (copy_to_user((void __user *)arg, &dma_bootstrap32, | 190 | if (copy_to_user((void __user *)arg, &dma_bootstrap32, |
192 | sizeof(dma_bootstrap32))) | 191 | sizeof(dma_bootstrap32))) |
193 | return -EFAULT; | 192 | return -EFAULT; |
194 | 193 | ||
195 | return 0; | 194 | return 0; |
@@ -210,8 +209,7 @@ drm_ioctl_compat_t *mga_compat_ioctls[] = { | |||
210 | * \param arg user argument. | 209 | * \param arg user argument. |
211 | * \return zero on success or negative number on failure. | 210 | * \return zero on success or negative number on failure. |
212 | */ | 211 | */ |
213 | long mga_compat_ioctl(struct file *filp, unsigned int cmd, | 212 | long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
214 | unsigned long arg) | ||
215 | { | 213 | { |
216 | unsigned int nr = DRM_IOCTL_NR(cmd); | 214 | unsigned int nr = DRM_IOCTL_NR(cmd); |
217 | drm_ioctl_compat_t *fn = NULL; | 215 | drm_ioctl_compat_t *fn = NULL; |
@@ -219,13 +217,13 @@ long mga_compat_ioctl(struct file *filp, unsigned int cmd, | |||
219 | 217 | ||
220 | if (nr < DRM_COMMAND_BASE) | 218 | if (nr < DRM_COMMAND_BASE) |
221 | return drm_compat_ioctl(filp, cmd, arg); | 219 | return drm_compat_ioctl(filp, cmd, arg); |
222 | 220 | ||
223 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) | 221 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) |
224 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; | 222 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; |
225 | 223 | ||
226 | lock_kernel(); /* XXX for now */ | 224 | lock_kernel(); /* XXX for now */ |
227 | if (fn != NULL) | 225 | if (fn != NULL) |
228 | ret = (*fn)(filp, cmd, arg); | 226 | ret = (*fn) (filp, cmd, arg); |
229 | else | 227 | else |
230 | ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); | 228 | ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); |
231 | unlock_kernel(); | 229 | unlock_kernel(); |