V4L/DVB (11303): tda7432: remove legacy code for old-style i2c API
[safe/jmp/linux-2.6] / drivers / media / video / stv680.c
index 56dc3d6..75f286f 100644 (file)
@@ -84,7 +84,8 @@ static unsigned int debug;
 #define PDEBUG(level, fmt, args...) \
        do { \
        if (debug >= level)     \
-               info("[%s:%d] " fmt, __func__, __LINE__ , ## args);     \
+               printk(KERN_INFO KBUILD_MODNAME " [%s:%d] \n" fmt,      \
+                       __func__, __LINE__ , ## args);  \
        } while (0)
 
 
@@ -1079,13 +1080,14 @@ static int stv680_newframe (struct usb_stv *stv680, int framenr)
  * Video4Linux
  *********************************************************************/
 
-static int stv_open (struct inode *inode, struct file *file)
+static int stv_open(struct file *file)
 {
        struct video_device *dev = video_devdata(file);
        struct usb_stv *stv680 = video_get_drvdata(dev);
        int err = 0;
 
        /* we are called with the BKL held */
+       lock_kernel();
        stv680->user = 1;
        err = stv_init (stv680);        /* main initialization routine for camera */
 
@@ -1099,11 +1101,12 @@ static int stv_open (struct inode *inode, struct file *file)
        }
        if (err)
                stv680->user = 0;
+       unlock_kernel();
 
        return err;
 }
 
-static int stv_close (struct inode *inode, struct file *file)
+static int stv_close(struct file *file)
 {
        struct video_device *dev = file->private_data;
        struct usb_stv *stv680 = video_get_drvdata(dev);
@@ -1129,8 +1132,7 @@ static int stv_close (struct inode *inode, struct file *file)
        return 0;
 }
 
-static int stv680_do_ioctl (struct inode *inode, struct file *file,
-                           unsigned int cmd, void *arg)
+static long stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 {
        struct video_device *vdev = file->private_data;
        struct usb_stv *stv680 = video_get_drvdata(vdev);
@@ -1297,10 +1299,10 @@ static int stv680_do_ioctl (struct inode *inode, struct file *file,
        return 0;
 }
 
-static int stv680_ioctl(struct inode *inode, struct file *file,
+static long stv680_ioctl(struct file *file,
                        unsigned int cmd, unsigned long arg)
 {
-       return video_usercopy(inode, file, cmd, arg, stv680_do_ioctl);
+       return video_usercopy(file, cmd, arg, stv680_do_ioctl);
 }
 
 static int stv680_mmap (struct file *file, struct vm_area_struct *vma)
@@ -1389,17 +1391,13 @@ static ssize_t stv680_read (struct file *file, char __user *buf,
        return realcount;
 }                              /* stv680_read */
 
-static const struct file_operations stv680_fops = {
+static const struct v4l2_file_operations stv680_fops = {
        .owner =        THIS_MODULE,
        .open =         stv_open,
        .release =      stv_close,
        .read =         stv680_read,
        .mmap =         stv680_mmap,
        .ioctl =        stv680_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl = v4l_compat_ioctl32,
-#endif
-       .llseek =       no_llseek,
 };
 static struct video_device stv680_template = {
        .name =         "STV0680 USB camera",
@@ -1462,12 +1460,13 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
        mutex_init (&stv680->lock);
        wmb ();
 
-       if (video_register_device (stv680->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {
+       if (video_register_device(stv680->vdev, VFL_TYPE_GRABBER, video_nr) < 0) {
                PDEBUG (0, "STV(e): video_register_device failed");
                retval = -EIO;
                goto error_vdev;
        }
-       PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor);
+       PDEBUG(0, "STV(i): registered new video device: video%d",
+               stv680->vdev->num);
 
        usb_set_intfdata (intf, stv680);
        retval = stv680_create_sysfs_files(stv680->vdev);
@@ -1550,7 +1549,8 @@ static int __init usb_stv680_init (void)
        }
        PDEBUG (0, "STV(i): usb camera driver version %s registering", DRIVER_VERSION);
 
-       info(DRIVER_DESC " " DRIVER_VERSION);
+       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+              DRIVER_DESC "\n");
        return 0;
 }