]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/et61x251/et61x251_core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6-omap-h63xx.git] / drivers / media / video / et61x251 / et61x251_core.c
index dfc9dd732c9d0f817fb0554b77f49d03a857b0f2..f786ab11d2cd9b1a48cb0aff6bd70f85c19abd2f 100644 (file)
@@ -398,7 +398,7 @@ int et61x251_i2c_write(struct et61x251_device* cam, u8 address, u8 value)
 
 /*****************************************************************************/
 
-static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs)
+static void et61x251_urb_complete(struct urb *urb)
 {
        struct et61x251_device* cam = urb->context;
        struct et61x251_frame_t** f;
@@ -973,16 +973,32 @@ static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
                         et61x251_show_i2c_val, et61x251_store_i2c_val);
 
 
-static void et61x251_create_sysfs(struct et61x251_device* cam)
+static int et61x251_create_sysfs(struct et61x251_device* cam)
 {
        struct video_device *v4ldev = cam->v4ldev;
+       int rc;
 
-       video_device_create_file(v4ldev, &class_device_attr_reg);
-       video_device_create_file(v4ldev, &class_device_attr_val);
+       rc = video_device_create_file(v4ldev, &class_device_attr_reg);
+       if (rc) goto err;
+       rc = video_device_create_file(v4ldev, &class_device_attr_val);
+       if (rc) goto err_reg;
        if (cam->sensor.sysfs_ops) {
-               video_device_create_file(v4ldev, &class_device_attr_i2c_reg);
-               video_device_create_file(v4ldev, &class_device_attr_i2c_val);
+               rc = video_device_create_file(v4ldev, &class_device_attr_i2c_reg);
+               if (rc) goto err_val;
+               rc = video_device_create_file(v4ldev, &class_device_attr_i2c_val);
+               if (rc) goto err_i2c_reg;
        }
+
+       return 0;
+
+err_i2c_reg:
+       video_device_remove_file(v4ldev, &class_device_attr_i2c_reg);
+err_val:
+       video_device_remove_file(v4ldev, &class_device_attr_val);
+err_reg:
+       video_device_remove_file(v4ldev, &class_device_attr_reg);
+err:
+       return rc;
 }
 #endif /* CONFIG_VIDEO_ADV_DEBUG */
 
@@ -2341,11 +2357,9 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
        case VIDIOC_G_CTRL:
                return et61x251_vidioc_g_ctrl(cam, arg);
 
-       case VIDIOC_S_CTRL_OLD:
        case VIDIOC_S_CTRL:
                return et61x251_vidioc_s_ctrl(cam, arg);
 
-       case VIDIOC_CROPCAP_OLD:
        case VIDIOC_CROPCAP:
                return et61x251_vidioc_cropcap(cam, arg);
 
@@ -2392,7 +2406,6 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
        case VIDIOC_G_PARM:
                return et61x251_vidioc_g_parm(cam, arg);
 
-       case VIDIOC_S_PARM_OLD:
        case VIDIOC_S_PARM:
                return et61x251_vidioc_s_parm(cam, arg);
 
@@ -2537,7 +2550,9 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
        dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0;
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
-       et61x251_create_sysfs(cam);
+       err = et61x251_create_sysfs(cam);
+       if (err)
+               goto fail2;
        DBG(2, "Optional device control through 'sysfs' interface ready");
 #endif
 
@@ -2547,6 +2562,13 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
 
        return 0;
 
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+fail2:
+       video_nr[dev_nr] = -1;
+       dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0;
+       mutex_unlock(&cam->dev_mutex);
+       video_unregister_device(cam->v4ldev);
+#endif
 fail:
        if (cam) {
                kfree(cam->control_buffer);