]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/stv680.c
V4L/DVB (8824): gspca: Too much code removed in the suspend/resume changeset.
[linux-2.6-omap-h63xx.git] / drivers / media / video / stv680.c
index afc32aa56fde2eb3952cb69dd214cdd9cd52701b..dce947439459ca46e2d020b49440a318a6c9e20c 100644 (file)
 #include <linux/errno.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <linux/usb.h>
 #include <linux/mutex.h>
 
 #include "stv680.h"
 
 static int video_nr = -1;
-static int swapRGB = 0;   /* default for auto sleect */
-static int swapRGB_on = 0; /* default to allow auto select; -1=swap never, +1= swap always */
 
-static unsigned int debug = 0;
+static int swapRGB;    /* 0 = default for auto select */
+
+/* 0 = default to allow auto select; -1 = swap never, +1 = swap always */
+static int swapRGB_on;
+
+static unsigned int debug;
 
 #define PDEBUG(level, fmt, args...) \
        do { \
        if (debug >= level)     \
-               info("[%s:%d] " fmt, __FUNCTION__, __LINE__ , ## args); \
+               info("[%s:%d] " fmt, __func__, __LINE__ , ## args);     \
        } while (0)
 
 
@@ -521,53 +525,54 @@ static int stv680_create_sysfs_files(struct video_device *vdev)
 {
        int rc;
 
-       rc = video_device_create_file(vdev, &dev_attr_model);
+       rc = device_create_file(&vdev->dev, &dev_attr_model);
        if (rc) goto err;
-       rc = video_device_create_file(vdev, &dev_attr_in_use);
+       rc = device_create_file(&vdev->dev, &dev_attr_in_use);
        if (rc) goto err_model;
-       rc = video_device_create_file(vdev, &dev_attr_streaming);
+       rc = device_create_file(&vdev->dev, &dev_attr_streaming);
        if (rc) goto err_inuse;
-       rc = video_device_create_file(vdev, &dev_attr_palette);
+       rc = device_create_file(&vdev->dev, &dev_attr_palette);
        if (rc) goto err_stream;
-       rc = video_device_create_file(vdev, &dev_attr_frames_total);
+       rc = device_create_file(&vdev->dev, &dev_attr_frames_total);
        if (rc) goto err_pal;
-       rc = video_device_create_file(vdev, &dev_attr_frames_read);
+       rc = device_create_file(&vdev->dev, &dev_attr_frames_read);
        if (rc) goto err_framtot;
-       rc = video_device_create_file(vdev, &dev_attr_packets_dropped);
+       rc = device_create_file(&vdev->dev, &dev_attr_packets_dropped);
        if (rc) goto err_framread;
-       rc = video_device_create_file(vdev, &dev_attr_decoding_errors);
+       rc = device_create_file(&vdev->dev, &dev_attr_decoding_errors);
        if (rc) goto err_dropped;
 
        return 0;
 
 err_dropped:
-       video_device_remove_file(vdev, &dev_attr_packets_dropped);
+       device_remove_file(&vdev->dev, &dev_attr_packets_dropped);
 err_framread:
-       video_device_remove_file(vdev, &dev_attr_frames_read);
+       device_remove_file(&vdev->dev, &dev_attr_frames_read);
 err_framtot:
-       video_device_remove_file(vdev, &dev_attr_frames_total);
+       device_remove_file(&vdev->dev, &dev_attr_frames_total);
 err_pal:
-       video_device_remove_file(vdev, &dev_attr_palette);
+       device_remove_file(&vdev->dev, &dev_attr_palette);
 err_stream:
-       video_device_remove_file(vdev, &dev_attr_streaming);
+       device_remove_file(&vdev->dev, &dev_attr_streaming);
 err_inuse:
-       video_device_remove_file(vdev, &dev_attr_in_use);
+       device_remove_file(&vdev->dev, &dev_attr_in_use);
 err_model:
-       video_device_remove_file(vdev, &dev_attr_model);
+       device_remove_file(&vdev->dev, &dev_attr_model);
 err:
+       PDEBUG(0, "STV(e): Could not create sysfs files");
        return rc;
 }
 
 static void stv680_remove_sysfs_files(struct video_device *vdev)
 {
-       video_device_remove_file(vdev, &dev_attr_model);
-       video_device_remove_file(vdev, &dev_attr_in_use);
-       video_device_remove_file(vdev, &dev_attr_streaming);
-       video_device_remove_file(vdev, &dev_attr_palette);
-       video_device_remove_file(vdev, &dev_attr_frames_total);
-       video_device_remove_file(vdev, &dev_attr_frames_read);
-       video_device_remove_file(vdev, &dev_attr_packets_dropped);
-       video_device_remove_file(vdev, &dev_attr_decoding_errors);
+       device_remove_file(&vdev->dev, &dev_attr_model);
+       device_remove_file(&vdev->dev, &dev_attr_in_use);
+       device_remove_file(&vdev->dev, &dev_attr_streaming);
+       device_remove_file(&vdev->dev, &dev_attr_palette);
+       device_remove_file(&vdev->dev, &dev_attr_frames_total);
+       device_remove_file(&vdev->dev, &dev_attr_frames_read);
+       device_remove_file(&vdev->dev, &dev_attr_packets_dropped);
+       device_remove_file(&vdev->dev, &dev_attr_decoding_errors);
 }
 
 /********************************************************************
@@ -1391,13 +1396,13 @@ static const struct file_operations stv680_fops = {
        .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 = {
-       .owner =        THIS_MODULE,
        .name =         "STV0680 USB camera",
-       .type =         VID_TYPE_CAPTURE,
        .fops =         &stv680_fops,
        .release =      video_device_release,
        .minor =        -1,
@@ -1449,7 +1454,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
                goto error;
        }
        memcpy(stv680->vdev, &stv680_template, sizeof(stv680_template));
-       stv680->vdev->dev = &intf->dev;
+       stv680->vdev->parent = &intf->dev;
        video_set_drvdata(stv680->vdev, stv680);
 
        memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name));
@@ -1457,7 +1462,7 @@ 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;