]> err.no Git - linux-2.6/blobdiff - drivers/media/video/vivi.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into next
[linux-2.6] / drivers / media / video / vivi.c
index b1e9592acb907bb06ca59d82e8fa6cafcf5384fc..059b01c11dc133e4abb708ace787fa9cc3242843 100644 (file)
@@ -39,6 +39,8 @@
 #include <linux/highmem.h>
 #include <linux/freezer.h>
 
+#define VIVI_MODULE_NAME "vivi"
+
 /* Wake up at about 30 fps */
 #define WAKE_NUMERATOR 30
 #define WAKE_DENOMINATOR 1001
@@ -47,7 +49,7 @@
 #include "font.h"
 
 #define VIVI_MAJOR_VERSION 0
-#define VIVI_MINOR_VERSION 4
+#define VIVI_MINOR_VERSION 5
 #define VIVI_RELEASE 0
 #define VIVI_VERSION \
        KERNEL_VERSION(VIVI_MAJOR_VERSION, VIVI_MINOR_VERSION, VIVI_RELEASE)
@@ -327,13 +329,14 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
        int hmax  = buf->vb.height;
        int wmax  = buf->vb.width;
        struct timeval ts;
-       char *tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC);
+       char *tmpbuf;
        void *vbuf = videobuf_to_vmalloc(&buf->vb);
 
-       if (!tmpbuf)
+       if (!vbuf)
                return;
 
-       if (!vbuf)
+       tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC);
+       if (!tmpbuf)
                return;
 
        for (h = 0; h < hmax; h++) {
@@ -629,7 +632,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
        return 0;
 }
 
-static int vidioc_enum_fmt_cap(struct file *file, void  *priv,
+static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
                                        struct v4l2_fmtdesc *f)
 {
        if (f->index > 0)
@@ -640,7 +643,7 @@ static int vidioc_enum_fmt_cap(struct file *file, void  *priv,
        return 0;
 }
 
-static int vidioc_g_fmt_cap(struct file *file, void *priv,
+static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f)
 {
        struct vivi_fh *fh = priv;
@@ -657,7 +660,7 @@ static int vidioc_g_fmt_cap(struct file *file, void *priv,
        return (0);
 }
 
-static int vidioc_try_fmt_cap(struct file *file, void *priv,
+static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
                        struct v4l2_format *f)
 {
        struct vivi_fh  *fh  = priv;
@@ -705,13 +708,13 @@ static int vidioc_try_fmt_cap(struct file *file, void *priv,
 }
 
 /*FIXME: This seems to be generic enough to be at videodev2 */
-static int vidioc_s_fmt_cap(struct file *file, void *priv,
+static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f)
 {
        struct vivi_fh  *fh = priv;
        struct videobuf_queue *q = &fh->vb_vidq;
 
-       int ret = vidioc_try_fmt_cap(file, fh, f);
+       int ret = vidioc_try_fmt_vid_cap(file, fh, f);
        if (ret < 0)
                return (ret);
 
@@ -888,7 +891,7 @@ static int vivi_open(struct inode *inode, struct file *file)
 {
        int minor = iminor(inode);
        struct vivi_dev *dev;
-       struct vivi_fh *fh;
+       struct vivi_fh *fh = NULL;
        int i;
        int retval = 0;
 
@@ -1016,10 +1019,15 @@ static int vivi_release(void)
                list_del(list);
                dev = list_entry(list, struct vivi_dev, vivi_devlist);
 
-               if (-1 != dev->vfd->minor)
+               if (-1 != dev->vfd->minor) {
                        video_unregister_device(dev->vfd);
-               else
+                       printk(KERN_INFO "%s: /dev/video%d unregistered.\n",
+                               VIVI_MODULE_NAME, dev->vfd->minor);
+               } else {
                        video_device_release(dev->vfd);
+                       printk(KERN_INFO "%s: /dev/video%d released.\n",
+                               VIVI_MODULE_NAME, dev->vfd->minor);
+               }
 
                kfree(dev);
        }
@@ -1065,10 +1073,10 @@ static struct video_device vivi_template = {
        .release        = video_device_release,
 
        .vidioc_querycap      = vidioc_querycap,
-       .vidioc_enum_fmt_cap  = vidioc_enum_fmt_cap,
-       .vidioc_g_fmt_cap     = vidioc_g_fmt_cap,
-       .vidioc_try_fmt_cap   = vidioc_try_fmt_cap,
-       .vidioc_s_fmt_cap     = vidioc_s_fmt_cap,
+       .vidioc_enum_fmt_vid_cap  = vidioc_enum_fmt_vid_cap,
+       .vidioc_g_fmt_vid_cap     = vidioc_g_fmt_vid_cap,
+       .vidioc_try_fmt_vid_cap   = vidioc_try_fmt_vid_cap,
+       .vidioc_s_fmt_vid_cap     = vidioc_s_fmt_vid_cap,
        .vidioc_reqbufs       = vidioc_reqbufs,
        .vidioc_querybuf      = vidioc_querybuf,
        .vidioc_qbuf          = vidioc_qbuf,
@@ -1130,6 +1138,8 @@ static int __init vivi_init(void)
                        video_nr++;
 
                dev->vfd = vfd;
+               printk(KERN_INFO "%s: V4L2 device registered as /dev/video%d\n",
+                       VIVI_MODULE_NAME, vfd->minor);
        }
 
        if (ret < 0) {
@@ -1137,7 +1147,9 @@ static int __init vivi_init(void)
                printk(KERN_INFO "Error %d while loading vivi driver\n", ret);
        } else
                printk(KERN_INFO "Video Technology Magazine Virtual Video "
-                                "Capture Board successfully loaded.\n");
+                       "Capture Board ver %u.%u.%u successfully loaded.\n",
+                       (VIVI_VERSION >> 16) & 0xFF, (VIVI_VERSION >> 8) & 0xFF,
+                       VIVI_VERSION & 0xFF);
        return ret;
 }