vserver 2.0 rc7
[linux-2.6.git] / drivers / media / video / zoran_driver.c
index 8af43a6..ba838a4 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
+#include <linux/wait.h>
 #include <linux/byteorder/generic.h>
 
 #include <linux/interrupt.h>
@@ -918,12 +919,12 @@ v4l_sync (struct file *file,
        }
 
        /* wait on this buffer to get ready */
-       while (zr->v4l_buffers.buffer[frame].state == BUZ_STATE_PEND) {
-               if (!interruptible_sleep_on_timeout(&zr->v4l_capq, 10 * HZ))
-                       return -ETIME;
-               else if (signal_pending(current))
-                       return -ERESTARTSYS;
-       }
+       if (!wait_event_interruptible_timeout(zr->v4l_capq,
+                               (zr->v4l_buffers.buffer[frame].state != BUZ_STATE_PEND),
+                               10*HZ))
+               return -ETIME;
+       if (signal_pending(current))
+               return -ERESTARTSYS;
 
        /* buffer should now be in BUZ_STATE_DONE */
        if (zr->v4l_buffers.buffer[frame].state != BUZ_STATE_DONE)
@@ -1107,7 +1108,7 @@ jpg_sync (struct file       *file,
        struct zoran_fh *fh = file->private_data;
        struct zoran *zr = fh->zr;
        unsigned long flags;
-       int frame, timeout;
+       int frame;
 
        if (fh->jpg_buffers.active == ZORAN_FREE) {
                dprintk(1,
@@ -1124,29 +1125,26 @@ jpg_sync (struct file       *file,
                        ZR_DEVNAME(zr));
                return -EINVAL;
        }
-       while (zr->jpg_que_tail == zr->jpg_dma_tail) {
-               if (zr->jpg_dma_tail == zr->jpg_dma_head)
-                       break;
+       if (!wait_event_interruptible_timeout(zr->jpg_capq,
+                       (zr->jpg_que_tail != zr->jpg_dma_tail ||
+                        zr->jpg_dma_tail == zr->jpg_dma_head),
+                       10*HZ)) {
+               int isr;
 
-               timeout =
-                   interruptible_sleep_on_timeout(&zr->jpg_capq, 10 * HZ);
-               if (!timeout) {
-                       int isr;
-
-                       btand(~ZR36057_JMC_Go_en, ZR36057_JMC);
-                       udelay(1);
-                       zr->codec->control(zr->codec, CODEC_G_STATUS,
+               btand(~ZR36057_JMC_Go_en, ZR36057_JMC);
+               udelay(1);
+               zr->codec->control(zr->codec, CODEC_G_STATUS,
                                           sizeof(isr), &isr);
-                       dprintk(1,
-                               KERN_ERR
-                               "%s: jpg_sync() - timeout: codec isr=0x%02x\n",
-                               ZR_DEVNAME(zr), isr);
+               dprintk(1,
+                       KERN_ERR
+                       "%s: jpg_sync() - timeout: codec isr=0x%02x\n",
+                       ZR_DEVNAME(zr), isr);
 
-                       return -ETIME;
+               return -ETIME;
 
-               } else if (signal_pending(current))
-                       return -ERESTARTSYS;
        }
+       if (signal_pending(current))
+               return -ERESTARTSYS;
 
        spin_lock_irqsave(&zr->spinlock, flags);
 
@@ -2694,7 +2692,7 @@ zoran_do_ioctl (struct inode *inode,
                strncpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card));
                strncpy(cap->driver, "zoran", sizeof(cap->driver));
                snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
-                        zr->pci_dev->slot_name);
+                        pci_name(zr->pci_dev));
                cap->version =
                    KERNEL_VERSION(MAJOR_VERSION, MINOR_VERSION,
                                   RELEASE_VERSION);
@@ -3761,7 +3759,7 @@ zoran_do_ioctl (struct inode *inode,
                v4l2_std_id *std = arg;
 
                dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n",
-                       ZR_DEVNAME(zr), *std);
+                       ZR_DEVNAME(zr), (unsigned long long)*std);
 
                if (*std == V4L2_STD_PAL)
                        norm = VIDEO_MODE_PAL;
@@ -3775,7 +3773,7 @@ zoran_do_ioctl (struct inode *inode,
                        dprintk(1,
                                KERN_ERR
                                "%s: VIDIOC_S_STD - invalid norm 0x%llx\n",
-                               ZR_DEVNAME(zr), *std);
+                               ZR_DEVNAME(zr), (unsigned long long)*std);
                        return -EINVAL;
                }
 
@@ -4108,7 +4106,7 @@ zoran_do_ioctl (struct inode *inode,
 
                dprintk(3,
                        KERN_DEBUG "%s: VIDIOC_QUERY_STD - std=0x%llx\n",
-                       ZR_DEVNAME(zr), *std);
+                       ZR_DEVNAME(zr), (unsigned long long)*std);
 
                if (*std == V4L2_STD_ALL || *std == V4L2_STD_NTSC ||
                    *std == V4L2_STD_PAL || (*std == V4L2_STD_SECAM &&