]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/media/radio/radio-si4713.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / media / radio / radio-si4713.c
index 13554ab13f76afd8c29893aabde59a1c3d5d6a20..726d367ad8d0f2119b5e832d8ccca593d2a6d3fa 100644 (file)
@@ -53,7 +53,8 @@ struct radio_si4713_device {
 /* radio_si4713_fops - file operations interface */
 static const struct v4l2_file_operations radio_si4713_fops = {
        .owner          = THIS_MODULE,
-       .ioctl          = video_ioctl2,
+       /* Note: locking is done at the subdev level in the i2c driver. */
+       .unlocked_ioctl = video_ioctl2,
 };
 
 /* Video4Linux Interface */
@@ -291,19 +292,19 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
                goto unregister_v4l2_dev;
        }
 
-       sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter, "si4713_i2c",
+       sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter,
                                        pdata->subdev_board_info, NULL);
        if (!sd) {
                dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n");
                rval = -ENODEV;
-               goto unregister_v4l2_dev;
+               goto put_adapter;
        }
 
        rsdev->radio_dev = video_device_alloc();
        if (!rsdev->radio_dev) {
                dev_err(&pdev->dev, "Failed to alloc video device.\n");
                rval = -ENOMEM;
-               goto unregister_v4l2_dev;
+               goto put_adapter;
        }
 
        memcpy(rsdev->radio_dev, &radio_si4713_vdev_template,
@@ -320,6 +321,8 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
 
 free_vdev:
        video_device_release(rsdev->radio_dev);
+put_adapter:
+       i2c_put_adapter(adapter);
 unregister_v4l2_dev:
        v4l2_device_unregister(&rsdev->v4l2_dev);
 free_rsdev:
@@ -335,8 +338,12 @@ static int __exit radio_si4713_pdriver_remove(struct platform_device *pdev)
        struct radio_si4713_device *rsdev = container_of(v4l2_dev,
                                                struct radio_si4713_device,
                                                v4l2_dev);
+       struct v4l2_subdev *sd = list_entry(v4l2_dev->subdevs.next,
+                                           struct v4l2_subdev, list);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
 
        video_unregister_device(rsdev->radio_dev);
+       i2c_put_adapter(client->adapter);
        v4l2_device_unregister(&rsdev->v4l2_dev);
        kfree(rsdev);