diff options
author | Eric Anholt <eric@anholt.net> | 2007-09-02 22:06:45 -0400 |
---|---|---|
committer | Dave Airlie <airlied@optimus.(none)> | 2007-10-14 20:38:20 -0400 |
commit | c153f45f9b7e30289157bba3ff5682291df16caa (patch) | |
tree | 33f21e1ebd83ec548751f3d490afe6230ab99972 /drivers/char/drm/drm_agpsupport.c | |
parent | b589ee5943a9610ebaea6e4e3433f2ae4d812b0b (diff) |
drm: Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
The data is now in kernel space, copied in/out as appropriate according to t
This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal
with those failures. This also means that XFree86 4.2.0 support for i810 DR
is lost.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_agpsupport.c')
-rw-r--r-- | drivers/char/drm/drm_agpsupport.c | 107 |
1 files changed, 33 insertions, 74 deletions
diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c index 6d7a69abdc62..214f4fbcba73 100644 --- a/drivers/char/drm/drm_agpsupport.c +++ b/drivers/char/drm/drm_agpsupport.c | |||
@@ -71,19 +71,16 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) | |||
71 | 71 | ||
72 | EXPORT_SYMBOL(drm_agp_info); | 72 | EXPORT_SYMBOL(drm_agp_info); |
73 | 73 | ||
74 | int drm_agp_info_ioctl(struct inode *inode, struct drm_file *file_priv, | 74 | int drm_agp_info_ioctl(struct drm_device *dev, void *data, |
75 | unsigned int cmd, unsigned long arg) | 75 | struct drm_file *file_priv) |
76 | { | 76 | { |
77 | struct drm_device *dev = file_priv->head->dev; | 77 | struct drm_agp_info *info = data; |
78 | struct drm_agp_info info; | ||
79 | int err; | 78 | int err; |
80 | 79 | ||
81 | err = drm_agp_info(dev, &info); | 80 | err = drm_agp_info(dev, info); |
82 | if (err) | 81 | if (err) |
83 | return err; | 82 | return err; |
84 | 83 | ||
85 | if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info))) | ||
86 | return -EFAULT; | ||
87 | return 0; | 84 | return 0; |
88 | } | 85 | } |
89 | 86 | ||
@@ -122,8 +119,8 @@ EXPORT_SYMBOL(drm_agp_acquire); | |||
122 | * Verifies the AGP device hasn't been acquired before and calls | 119 | * Verifies the AGP device hasn't been acquired before and calls |
123 | * \c agp_backend_acquire. | 120 | * \c agp_backend_acquire. |
124 | */ | 121 | */ |
125 | int drm_agp_acquire_ioctl(struct inode *inode, struct drm_file *file_priv, | 122 | int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, |
126 | unsigned int cmd, unsigned long arg) | 123 | struct drm_file *file_priv) |
127 | { | 124 | { |
128 | return drm_agp_acquire((struct drm_device *) file_priv->head->dev); | 125 | return drm_agp_acquire((struct drm_device *) file_priv->head->dev); |
129 | } | 126 | } |
@@ -146,11 +143,9 @@ int drm_agp_release(struct drm_device * dev) | |||
146 | } | 143 | } |
147 | EXPORT_SYMBOL(drm_agp_release); | 144 | EXPORT_SYMBOL(drm_agp_release); |
148 | 145 | ||
149 | int drm_agp_release_ioctl(struct inode *inode, struct drm_file *file_priv, | 146 | int drm_agp_release_ioctl(struct drm_device *dev, void *data, |
150 | unsigned int cmd, unsigned long arg) | 147 | struct drm_file *file_priv) |
151 | { | 148 | { |
152 | struct drm_device *dev = file_priv->head->dev; | ||
153 | |||
154 | return drm_agp_release(dev); | 149 | return drm_agp_release(dev); |
155 | } | 150 | } |
156 | 151 | ||
@@ -178,16 +173,12 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) | |||
178 | 173 | ||
179 | EXPORT_SYMBOL(drm_agp_enable); | 174 | EXPORT_SYMBOL(drm_agp_enable); |
180 | 175 | ||
181 | int drm_agp_enable_ioctl(struct inode *inode, struct drm_file *file_priv, | 176 | int drm_agp_enable_ioctl(struct drm_device *dev, void *data, |
182 | unsigned int cmd, unsigned long arg) | 177 | struct drm_file *file_priv) |
183 | { | 178 | { |
184 | struct drm_device *dev = file_priv->head->dev; | 179 | struct drm_agp_mode *mode = data; |
185 | struct drm_agp_mode mode; | ||
186 | |||
187 | if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode))) | ||
188 | return -EFAULT; | ||
189 | 180 | ||
190 | return drm_agp_enable(dev, mode); | 181 | return drm_agp_enable(dev, *mode); |
191 | } | 182 | } |
192 | 183 | ||
193 | /** | 184 | /** |
@@ -236,34 +227,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) | |||
236 | } | 227 | } |
237 | EXPORT_SYMBOL(drm_agp_alloc); | 228 | EXPORT_SYMBOL(drm_agp_alloc); |
238 | 229 | ||
239 | int drm_agp_alloc_ioctl(struct inode *inode, struct drm_file *file_priv, | ||
240 | unsigned int cmd, unsigned long arg) | ||
241 | { | ||
242 | struct drm_device *dev = file_priv->head->dev; | ||
243 | struct drm_agp_buffer request; | ||
244 | struct drm_agp_buffer __user *argp = (void __user *)arg; | ||
245 | int err; | ||
246 | |||
247 | if (copy_from_user(&request, argp, sizeof(request))) | ||
248 | return -EFAULT; | ||
249 | 230 | ||
250 | err = drm_agp_alloc(dev, &request); | 231 | int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, |
251 | if (err) | 232 | struct drm_file *file_priv) |
252 | return err; | 233 | { |
253 | 234 | struct drm_agp_buffer *request = data; | |
254 | if (copy_to_user(argp, &request, sizeof(request))) { | ||
255 | struct drm_agp_mem *entry; | ||
256 | list_for_each_entry(entry, &dev->agp->memory, head) { | ||
257 | if (entry->handle == request.handle) | ||
258 | break; | ||
259 | } | ||
260 | list_del(&entry->head); | ||
261 | drm_free_agp(entry->memory, entry->pages); | ||
262 | drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); | ||
263 | return -EFAULT; | ||
264 | } | ||
265 | 235 | ||
266 | return 0; | 236 | return drm_agp_alloc(dev, request); |
267 | } | 237 | } |
268 | 238 | ||
269 | /** | 239 | /** |
@@ -317,17 +287,13 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) | |||
317 | } | 287 | } |
318 | EXPORT_SYMBOL(drm_agp_unbind); | 288 | EXPORT_SYMBOL(drm_agp_unbind); |
319 | 289 | ||
320 | int drm_agp_unbind_ioctl(struct inode *inode, struct drm_file *file_priv, | ||
321 | unsigned int cmd, unsigned long arg) | ||
322 | { | ||
323 | struct drm_device *dev = file_priv->head->dev; | ||
324 | struct drm_agp_binding request; | ||
325 | 290 | ||
326 | if (copy_from_user | 291 | int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, |
327 | (&request, (struct drm_agp_binding __user *) arg, sizeof(request))) | 292 | struct drm_file *file_priv) |
328 | return -EFAULT; | 293 | { |
294 | struct drm_agp_binding *request = data; | ||
329 | 295 | ||
330 | return drm_agp_unbind(dev, &request); | 296 | return drm_agp_unbind(dev, request); |
331 | } | 297 | } |
332 | 298 | ||
333 | /** | 299 | /** |
@@ -365,17 +331,13 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) | |||
365 | } | 331 | } |
366 | EXPORT_SYMBOL(drm_agp_bind); | 332 | EXPORT_SYMBOL(drm_agp_bind); |
367 | 333 | ||
368 | int drm_agp_bind_ioctl(struct inode *inode, struct drm_file *file_priv, | ||
369 | unsigned int cmd, unsigned long arg) | ||
370 | { | ||
371 | struct drm_device *dev = file_priv->head->dev; | ||
372 | struct drm_agp_binding request; | ||
373 | 334 | ||
374 | if (copy_from_user | 335 | int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
375 | (&request, (struct drm_agp_binding __user *) arg, sizeof(request))) | 336 | struct drm_file *file_priv) |
376 | return -EFAULT; | 337 | { |
338 | struct drm_agp_binding *request = data; | ||
377 | 339 | ||
378 | return drm_agp_bind(dev, &request); | 340 | return drm_agp_bind(dev, request); |
379 | } | 341 | } |
380 | 342 | ||
381 | /** | 343 | /** |
@@ -411,17 +373,14 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) | |||
411 | } | 373 | } |
412 | EXPORT_SYMBOL(drm_agp_free); | 374 | EXPORT_SYMBOL(drm_agp_free); |
413 | 375 | ||
414 | int drm_agp_free_ioctl(struct inode *inode, struct drm_file *file_priv, | ||
415 | unsigned int cmd, unsigned long arg) | ||
416 | { | ||
417 | struct drm_device *dev = file_priv->head->dev; | ||
418 | struct drm_agp_buffer request; | ||
419 | 376 | ||
420 | if (copy_from_user | ||
421 | (&request, (struct drm_agp_buffer __user *) arg, sizeof(request))) | ||
422 | return -EFAULT; | ||
423 | 377 | ||
424 | return drm_agp_free(dev, &request); | 378 | int drm_agp_free_ioctl(struct drm_device *dev, void *data, |
379 | struct drm_file *file_priv) | ||
380 | { | ||
381 | struct drm_agp_buffer *request = data; | ||
382 | |||
383 | return drm_agp_free(dev, request); | ||
425 | } | 384 | } |
426 | 385 | ||
427 | /** | 386 | /** |