diff options
author | Dave Airlie <airlied@linux.ie> | 2007-05-25 15:01:51 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-07-10 21:58:02 -0400 |
commit | bd1b331fae2813d9f03ceee649296f02edc0b893 (patch) | |
tree | 6139f72ebae88c332c754745f3d98cbe794ae4de /drivers/char/drm/drm_irq.c | |
parent | 4eb6bf6bfb580afaf1e1a1d30cba17a078530cf4 (diff) |
drm: cleanup use of Linux list handling macros
This makes the drms use of the list handling macros a lot cleaner
and more along the lines of how they should be used and uses them
in some more places.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_irq.c')
-rw-r--r-- | drivers/char/drm/drm_irq.c | 20 |
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); |