aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/via_irq.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-09-02 22:06:45 -0400
committerDave Airlie <airlied@optimus.(none)>2007-10-14 20:38:20 -0400
commitc153f45f9b7e30289157bba3ff5682291df16caa (patch)
tree33f21e1ebd83ec548751f3d490afe6230ab99972 /drivers/char/drm/via_irq.c
parentb589ee5943a9610ebaea6e4e3433f2ae4d812b0b (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/via_irq.c')
-rw-r--r--drivers/char/drm/via_irq.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c
index a5297e70f94a..9c1d52bc92d7 100644
--- a/drivers/char/drm/via_irq.c
+++ b/drivers/char/drm/via_irq.c
@@ -331,11 +331,9 @@ void via_driver_irq_uninstall(struct drm_device * dev)
331 } 331 }
332} 332}
333 333
334int via_wait_irq(DRM_IOCTL_ARGS) 334int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv)
335{ 335{
336 DRM_DEVICE; 336 drm_via_irqwait_t *irqwait = data;
337 drm_via_irqwait_t __user *argp = (void __user *)data;
338 drm_via_irqwait_t irqwait;
339 struct timeval now; 337 struct timeval now;
340 int ret = 0; 338 int ret = 0;
341 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 339 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
@@ -345,40 +343,37 @@ int via_wait_irq(DRM_IOCTL_ARGS)
345 if (!dev->irq) 343 if (!dev->irq)
346 return -EINVAL; 344 return -EINVAL;
347 345
348 DRM_COPY_FROM_USER_IOCTL(irqwait, argp, sizeof(irqwait)); 346 if (irqwait->request.irq >= dev_priv->num_irqs) {
349 if (irqwait.request.irq >= dev_priv->num_irqs) {
350 DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, 347 DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__,
351 irqwait.request.irq); 348 irqwait->request.irq);
352 return -EINVAL; 349 return -EINVAL;
353 } 350 }
354 351
355 cur_irq += irqwait.request.irq; 352 cur_irq += irqwait->request.irq;
356 353
357 switch (irqwait.request.type & ~VIA_IRQ_FLAGS_MASK) { 354 switch (irqwait->request.type & ~VIA_IRQ_FLAGS_MASK) {
358 case VIA_IRQ_RELATIVE: 355 case VIA_IRQ_RELATIVE:
359 irqwait.request.sequence += atomic_read(&cur_irq->irq_received); 356 irqwait->request.sequence += atomic_read(&cur_irq->irq_received);
360 irqwait.request.type &= ~_DRM_VBLANK_RELATIVE; 357 irqwait->request.type &= ~_DRM_VBLANK_RELATIVE;
361 case VIA_IRQ_ABSOLUTE: 358 case VIA_IRQ_ABSOLUTE:
362 break; 359 break;
363 default: 360 default:
364 return -EINVAL; 361 return -EINVAL;
365 } 362 }
366 363
367 if (irqwait.request.type & VIA_IRQ_SIGNAL) { 364 if (irqwait->request.type & VIA_IRQ_SIGNAL) {
368 DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n", 365 DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n",
369 __FUNCTION__); 366 __FUNCTION__);
370 return -EINVAL; 367 return -EINVAL;
371 } 368 }
372 369
373 force_sequence = (irqwait.request.type & VIA_IRQ_FORCE_SEQUENCE); 370 force_sequence = (irqwait->request.type & VIA_IRQ_FORCE_SEQUENCE);
374 371
375 ret = via_driver_irq_wait(dev, irqwait.request.irq, force_sequence, 372 ret = via_driver_irq_wait(dev, irqwait->request.irq, force_sequence,
376 &irqwait.request.sequence); 373 &irqwait->request.sequence);
377 do_gettimeofday(&now); 374 do_gettimeofday(&now);
378 irqwait.reply.tval_sec = now.tv_sec; 375 irqwait->reply.tval_sec = now.tv_sec;
379 irqwait.reply.tval_usec = now.tv_usec; 376 irqwait->reply.tval_usec = now.tv_usec;
380
381 DRM_COPY_TO_USER_IOCTL(argp, irqwait, sizeof(irqwait));
382 377
383 return ret; 378 return ret;
384} 379}