drm: Make locked tasklet handling more robust.
author=?utf-8?q?Michel_D=C3=A4nzer?= <michel@tungstengraphics.com>
Tue, 24 Oct 2006 13:30:01 +0000 (23:30 +1000)
committerairlied <airlied@linux.ie>
Thu, 7 Dec 2006 04:53:29 +0000 (15:53 +1100)
Initialize the spinlock unconditionally when struct drm_device is filled in,
and return early in drm_locked_tasklet() if the driver doesn't support IRQs.

Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drm_irq.c
drivers/char/drm/drm_stub.c

index 2b10e5b60cfa98737b616511b7897cdb6b656bf1..b08608a9f02666da3a948373998919d58ee28a93 100644 (file)
@@ -119,7 +119,6 @@ static int drm_irq_install(drm_device_t * dev)
                init_waitqueue_head(&dev->vbl_queue);
 
                spin_lock_init(&dev->vbl_lock);
-               spin_lock_init(&dev->tasklet_lock);
 
                INIT_LIST_HEAD(&dev->vbl_sigs.head);
                INIT_LIST_HEAD(&dev->vbl_sigs2.head);
@@ -456,7 +455,8 @@ void drm_locked_tasklet(drm_device_t *dev, void (*func)(drm_device_t*))
        unsigned long irqflags;
        static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0);
 
-       if (test_bit(TASKLET_STATE_SCHED, &drm_tasklet.state))
+       if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ) ||
+           test_bit(TASKLET_STATE_SCHED, &drm_tasklet.state))
                return;
 
        spin_lock_irqsave(&dev->tasklet_lock, irqflags);
index 6f748e194cf937ed3a1cd0102b449f3583d45f72..5fd6dc0870cf7b4d36c6b526fceca7e846e5096d 100644 (file)
@@ -61,6 +61,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
 
        spin_lock_init(&dev->count_lock);
        spin_lock_init(&dev->drw_lock);
+       spin_lock_init(&dev->tasklet_lock);
        init_timer(&dev->timer);
        mutex_init(&dev->struct_mutex);
        mutex_init(&dev->ctxlist_mutex);