[PATCH] prevent dmesg warning in zr36067 driver
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 7 Nov 2005 09:00:22 +0000 (01:00 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:47 +0000 (07:53 -0800)
Fix the warning "Debug: sleeping function called from invalid context at
include/asm/semaphore.h:102" that the zr36067 driver emits every time an
application using JPEG capture starts up (e.g.  mjpegtools' lavrec).

The warning is harmless, but clogs up the dmesg output.  This was logged as
bugzilla #5403.  (Thanks to Christian Casteyde for helping me in fixing
this long-standing annoyance.)

Signed-off-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/media/video/zoran_driver.c

index 53adeb70f2cafb2f7a551ff5e121782f306df329..07bde9acd672cbac58f1973f0b4a3a1697d32907 100644 (file)
@@ -996,8 +996,6 @@ zoran_jpg_queue_frame (struct file          *file,
                return -EINVAL;
        }
 
-       spin_lock_irqsave(&zr->spinlock, flags);
-
        if (fh->jpg_buffers.active == ZORAN_FREE) {
                if (zr->jpg_buffers.active == ZORAN_FREE) {
                        zr->jpg_buffers = fh->jpg_buffers;
@@ -1016,6 +1014,8 @@ zoran_jpg_queue_frame (struct file          *file,
                zr36057_enable_jpg(zr, mode);
        }
 
+       spin_lock_irqsave(&zr->spinlock, flags);
+
        if (!res) {
                switch (zr->jpg_buffers.buffer[num].state) {
                case BUZ_STATE_DONE: