V4L/DVB (8818): gspca: Reinitialize the device on resume.
[safe/jmp/linux-2.6] / drivers / media / video / ov511.c
index d55d580..3d3c48d 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/slab.h>
 #include <linux/ctype.h>
 #include <linux/pagemap.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <linux/mm.h>
 #include <linux/device.h>
@@ -627,9 +626,9 @@ ov511_i2c_write_internal(struct usb_ov511 *ov,
                        break;
 
                /* Retry until idle */
-               do
+               do {
                        rc = reg_r(ov, R511_I2C_CTL);
-               while (rc > 0 && ((rc&1) == 0));
+               while (rc > 0 && ((rc&1) == 0));
                if (rc < 0)
                        break;
 
@@ -704,9 +703,9 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
                        return rc;
 
                /* Retry until idle */
-               do
-                        rc = reg_r(ov, R511_I2C_CTL);
-               while (rc > 0 && ((rc&1) == 0));
+               do {
+                       rc = reg_r(ov, R511_I2C_CTL);
+               } while (rc > 0 && ((rc & 1) == 0));
                if (rc < 0)
                        return rc;
 
@@ -730,9 +729,9 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
                        return rc;
 
                /* Retry until idle */
-               do
+               do {
                        rc = reg_r(ov, R511_I2C_CTL);
-               while (rc > 0 && ((rc&1) == 0));
+               while (rc > 0 && ((rc&1) == 0));
                if (rc < 0)
                        return rc;
 
@@ -4660,14 +4659,14 @@ static const struct file_operations ov511_fops = {
        .read =         ov51x_v4l1_read,
        .mmap =         ov51x_v4l1_mmap,
        .ioctl =        ov51x_v4l1_ioctl,
+#ifdef CONFIG_COMPAT
        .compat_ioctl = v4l_compat_ioctl32,
+#endif
        .llseek =       no_llseek,
 };
 
 static struct video_device vdev_template = {
-       .owner =        THIS_MODULE,
        .name =         "OV511 USB Camera",
-       .type =         VID_TYPE_CAPTURE,
        .fops =         &ov511_fops,
        .release =      video_device_release,
        .minor =        -1,
@@ -5660,43 +5659,43 @@ static int ov_create_sysfs(struct video_device *vdev)
 {
        int rc;
 
-       rc = video_device_create_file(vdev, &dev_attr_custom_id);
+       rc = device_create_file(&vdev->dev, &dev_attr_custom_id);
        if (rc) goto err;
-       rc = video_device_create_file(vdev, &dev_attr_model);
+       rc = device_create_file(&vdev->dev, &dev_attr_model);
        if (rc) goto err_id;
-       rc = video_device_create_file(vdev, &dev_attr_bridge);
+       rc = device_create_file(&vdev->dev, &dev_attr_bridge);
        if (rc) goto err_model;
-       rc = video_device_create_file(vdev, &dev_attr_sensor);
+       rc = device_create_file(&vdev->dev, &dev_attr_sensor);
        if (rc) goto err_bridge;
-       rc = video_device_create_file(vdev, &dev_attr_brightness);
+       rc = device_create_file(&vdev->dev, &dev_attr_brightness);
        if (rc) goto err_sensor;
-       rc = video_device_create_file(vdev, &dev_attr_saturation);
+       rc = device_create_file(&vdev->dev, &dev_attr_saturation);
        if (rc) goto err_bright;
-       rc = video_device_create_file(vdev, &dev_attr_contrast);
+       rc = device_create_file(&vdev->dev, &dev_attr_contrast);
        if (rc) goto err_sat;
-       rc = video_device_create_file(vdev, &dev_attr_hue);
+       rc = device_create_file(&vdev->dev, &dev_attr_hue);
        if (rc) goto err_contrast;
-       rc = video_device_create_file(vdev, &dev_attr_exposure);
+       rc = device_create_file(&vdev->dev, &dev_attr_exposure);
        if (rc) goto err_hue;
 
        return 0;
 
 err_hue:
-       video_device_remove_file(vdev, &dev_attr_hue);
+       device_remove_file(&vdev->dev, &dev_attr_hue);
 err_contrast:
-       video_device_remove_file(vdev, &dev_attr_contrast);
+       device_remove_file(&vdev->dev, &dev_attr_contrast);
 err_sat:
-       video_device_remove_file(vdev, &dev_attr_saturation);
+       device_remove_file(&vdev->dev, &dev_attr_saturation);
 err_bright:
-       video_device_remove_file(vdev, &dev_attr_brightness);
+       device_remove_file(&vdev->dev, &dev_attr_brightness);
 err_sensor:
-       video_device_remove_file(vdev, &dev_attr_sensor);
+       device_remove_file(&vdev->dev, &dev_attr_sensor);
 err_bridge:
-       video_device_remove_file(vdev, &dev_attr_bridge);
+       device_remove_file(&vdev->dev, &dev_attr_bridge);
 err_model:
-       video_device_remove_file(vdev, &dev_attr_model);
+       device_remove_file(&vdev->dev, &dev_attr_model);
 err_id:
-       video_device_remove_file(vdev, &dev_attr_custom_id);
+       device_remove_file(&vdev->dev, &dev_attr_custom_id);
 err:
        return rc;
 }
@@ -5832,7 +5831,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
                goto error;
 
        memcpy(ov->vdev, &vdev_template, sizeof(*ov->vdev));
-       ov->vdev->dev = &dev->dev;
+       ov->vdev->parent = &intf->dev;
        video_set_drvdata(ov->vdev, ov);
 
        for (i = 0; i < OV511_MAX_UNIT_VIDEO; i++) {