aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_irq.c')
-rw-r--r--drivers/char/drm/drm_irq.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 2e75331fd83e..ae3053ce7b2c 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -120,8 +120,8 @@ static int drm_irq_install(drm_device_t * dev)
120 120
121 spin_lock_init(&dev->vbl_lock); 121 spin_lock_init(&dev->vbl_lock);
122 122
123 INIT_LIST_HEAD(&dev->vbl_sigs.head); 123 INIT_LIST_HEAD(&dev->vbl_sigs);
124 INIT_LIST_HEAD(&dev->vbl_sigs2.head); 124 INIT_LIST_HEAD(&dev->vbl_sigs2);
125 125
126 dev->vbl_pending = 0; 126 dev->vbl_pending = 0;
127 } 127 }
@@ -292,7 +292,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
292 292
293 if (flags & _DRM_VBLANK_SIGNAL) { 293 if (flags & _DRM_VBLANK_SIGNAL) {
294 unsigned long irqflags; 294 unsigned long irqflags;
295 drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) 295 struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
296 ? &dev->vbl_sigs2 : &dev->vbl_sigs; 296 ? &dev->vbl_sigs2 : &dev->vbl_sigs;
297 drm_vbl_sig_t *vbl_sig; 297 drm_vbl_sig_t *vbl_sig;
298 298
@@ -302,7 +302,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
302 * for the same vblank sequence number; nothing to be done in 302 * for the same vblank sequence number; nothing to be done in
303 * that case 303 * that case
304 */ 304 */
305 list_for_each_entry(vbl_sig, &vbl_sigs->head, head) { 305 list_for_each_entry(vbl_sig, vbl_sigs, head) {
306 if (vbl_sig->sequence == vblwait.request.sequence 306 if (vbl_sig->sequence == vblwait.request.sequence
307 && vbl_sig->info.si_signo == vblwait.request.signal 307 && vbl_sig->info.si_signo == vblwait.request.signal
308 && vbl_sig->task == current) { 308 && vbl_sig->task == current) {
@@ -336,7 +336,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
336 336
337 spin_lock_irqsave(&dev->vbl_lock, irqflags); 337 spin_lock_irqsave(&dev->vbl_lock, irqflags);
338 338
339 list_add_tail((struct list_head *)vbl_sig, &vbl_sigs->head); 339 list_add_tail(&vbl_sig->head, vbl_sigs);
340 340
341 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 341 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
342 342
@@ -379,20 +379,18 @@ void drm_vbl_send_signals(drm_device_t * dev)
379 spin_lock_irqsave(&dev->vbl_lock, flags); 379 spin_lock_irqsave(&dev->vbl_lock, flags);
380 380
381 for (i = 0; i < 2; i++) { 381 for (i = 0; i < 2; i++) {
382 struct list_head *list, *tmp; 382 drm_vbl_sig_t *vbl_sig, *tmp;
383 drm_vbl_sig_t *vbl_sig; 383 struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
384 drm_vbl_sig_t *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
385 unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 : 384 unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 :
386 &dev->vbl_received); 385 &dev->vbl_received);
387 386
388 list_for_each_safe(list, tmp, &vbl_sigs->head) { 387 list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) {
389 vbl_sig = list_entry(list, drm_vbl_sig_t, head);
390 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { 388 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
391 vbl_sig->info.si_code = vbl_seq; 389 vbl_sig->info.si_code = vbl_seq;
392 send_sig_info(vbl_sig->info.si_signo, 390 send_sig_info(vbl_sig->info.si_signo,
393 &vbl_sig->info, vbl_sig->task); 391 &vbl_sig->info, vbl_sig->task);
394 392
395 list_del(list); 393 list_del(&vbl_sig->head);
396 394
397 drm_free(vbl_sig, sizeof(*vbl_sig), 395 drm_free(vbl_sig, sizeof(*vbl_sig),
398 DRM_MEM_DRIVER); 396 DRM_MEM_DRIVER);