diff options
-rw-r--r-- | drivers/media/platform/davinci/vpfe_capture.c | 26 | ||||
-rw-r--r-- | include/media/davinci/vpfe_capture.h | 2 |
2 files changed, 8 insertions, 20 deletions
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index b41bf7e822c8..ccfcf3f528d3 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -1871,16 +1871,9 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1871 | goto probe_free_ccdc_cfg_mem; | 1871 | goto probe_free_ccdc_cfg_mem; |
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | /* Allocate memory for video device */ | 1874 | vfd = &vpfe_dev->video_dev; |
1875 | vfd = video_device_alloc(); | ||
1876 | if (NULL == vfd) { | ||
1877 | ret = -ENOMEM; | ||
1878 | v4l2_err(pdev->dev.driver, "Unable to alloc video device\n"); | ||
1879 | goto probe_out_release_irq; | ||
1880 | } | ||
1881 | |||
1882 | /* Initialize field of video device */ | 1875 | /* Initialize field of video device */ |
1883 | vfd->release = video_device_release; | 1876 | vfd->release = video_device_release_empty; |
1884 | vfd->fops = &vpfe_fops; | 1877 | vfd->fops = &vpfe_fops; |
1885 | vfd->ioctl_ops = &vpfe_ioctl_ops; | 1878 | vfd->ioctl_ops = &vpfe_ioctl_ops; |
1886 | vfd->tvnorms = 0; | 1879 | vfd->tvnorms = 0; |
@@ -1891,14 +1884,12 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1891 | (VPFE_CAPTURE_VERSION_CODE >> 16) & 0xff, | 1884 | (VPFE_CAPTURE_VERSION_CODE >> 16) & 0xff, |
1892 | (VPFE_CAPTURE_VERSION_CODE >> 8) & 0xff, | 1885 | (VPFE_CAPTURE_VERSION_CODE >> 8) & 0xff, |
1893 | (VPFE_CAPTURE_VERSION_CODE) & 0xff); | 1886 | (VPFE_CAPTURE_VERSION_CODE) & 0xff); |
1894 | /* Set video_dev to the video device */ | ||
1895 | vpfe_dev->video_dev = vfd; | ||
1896 | 1887 | ||
1897 | ret = v4l2_device_register(&pdev->dev, &vpfe_dev->v4l2_dev); | 1888 | ret = v4l2_device_register(&pdev->dev, &vpfe_dev->v4l2_dev); |
1898 | if (ret) { | 1889 | if (ret) { |
1899 | v4l2_err(pdev->dev.driver, | 1890 | v4l2_err(pdev->dev.driver, |
1900 | "Unable to register v4l2 device.\n"); | 1891 | "Unable to register v4l2 device.\n"); |
1901 | goto probe_out_video_release; | 1892 | goto probe_out_release_irq; |
1902 | } | 1893 | } |
1903 | v4l2_info(&vpfe_dev->v4l2_dev, "v4l2 device registered\n"); | 1894 | v4l2_info(&vpfe_dev->v4l2_dev, "v4l2 device registered\n"); |
1904 | spin_lock_init(&vpfe_dev->irqlock); | 1895 | spin_lock_init(&vpfe_dev->irqlock); |
@@ -1914,7 +1905,7 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1914 | v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, | 1905 | v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, |
1915 | "video_dev=%p\n", &vpfe_dev->video_dev); | 1906 | "video_dev=%p\n", &vpfe_dev->video_dev); |
1916 | vpfe_dev->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1907 | vpfe_dev->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1917 | ret = video_register_device(vpfe_dev->video_dev, | 1908 | ret = video_register_device(&vpfe_dev->video_dev, |
1918 | VFL_TYPE_GRABBER, -1); | 1909 | VFL_TYPE_GRABBER, -1); |
1919 | 1910 | ||
1920 | if (ret) { | 1911 | if (ret) { |
@@ -1927,7 +1918,7 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1927 | /* set the driver data in platform device */ | 1918 | /* set the driver data in platform device */ |
1928 | platform_set_drvdata(pdev, vpfe_dev); | 1919 | platform_set_drvdata(pdev, vpfe_dev); |
1929 | /* set driver private data */ | 1920 | /* set driver private data */ |
1930 | video_set_drvdata(vpfe_dev->video_dev, vpfe_dev); | 1921 | video_set_drvdata(&vpfe_dev->video_dev, vpfe_dev); |
1931 | i2c_adap = i2c_get_adapter(vpfe_cfg->i2c_adapter_id); | 1922 | i2c_adap = i2c_get_adapter(vpfe_cfg->i2c_adapter_id); |
1932 | num_subdevs = vpfe_cfg->num_subdevs; | 1923 | num_subdevs = vpfe_cfg->num_subdevs; |
1933 | vpfe_dev->sd = kmalloc(sizeof(struct v4l2_subdev *) * num_subdevs, | 1924 | vpfe_dev->sd = kmalloc(sizeof(struct v4l2_subdev *) * num_subdevs, |
@@ -1979,12 +1970,9 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1979 | probe_sd_out: | 1970 | probe_sd_out: |
1980 | kfree(vpfe_dev->sd); | 1971 | kfree(vpfe_dev->sd); |
1981 | probe_out_video_unregister: | 1972 | probe_out_video_unregister: |
1982 | video_unregister_device(vpfe_dev->video_dev); | 1973 | video_unregister_device(&vpfe_dev->video_dev); |
1983 | probe_out_v4l2_unregister: | 1974 | probe_out_v4l2_unregister: |
1984 | v4l2_device_unregister(&vpfe_dev->v4l2_dev); | 1975 | v4l2_device_unregister(&vpfe_dev->v4l2_dev); |
1985 | probe_out_video_release: | ||
1986 | if (!video_is_registered(vpfe_dev->video_dev)) | ||
1987 | video_device_release(vpfe_dev->video_dev); | ||
1988 | probe_out_release_irq: | 1976 | probe_out_release_irq: |
1989 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); | 1977 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); |
1990 | probe_free_ccdc_cfg_mem: | 1978 | probe_free_ccdc_cfg_mem: |
@@ -2007,7 +1995,7 @@ static int vpfe_remove(struct platform_device *pdev) | |||
2007 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); | 1995 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); |
2008 | kfree(vpfe_dev->sd); | 1996 | kfree(vpfe_dev->sd); |
2009 | v4l2_device_unregister(&vpfe_dev->v4l2_dev); | 1997 | v4l2_device_unregister(&vpfe_dev->v4l2_dev); |
2010 | video_unregister_device(vpfe_dev->video_dev); | 1998 | video_unregister_device(&vpfe_dev->video_dev); |
2011 | kfree(vpfe_dev); | 1999 | kfree(vpfe_dev); |
2012 | kfree(ccdc_cfg); | 2000 | kfree(ccdc_cfg); |
2013 | return 0; | 2001 | return 0; |
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 288772e6900a..28bcd71cdd26 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h | |||
@@ -102,7 +102,7 @@ struct vpfe_config { | |||
102 | struct vpfe_device { | 102 | struct vpfe_device { |
103 | /* V4l2 specific parameters */ | 103 | /* V4l2 specific parameters */ |
104 | /* Identifies video device for this channel */ | 104 | /* Identifies video device for this channel */ |
105 | struct video_device *video_dev; | 105 | struct video_device video_dev; |
106 | /* sub devices */ | 106 | /* sub devices */ |
107 | struct v4l2_subdev **sd; | 107 | struct v4l2_subdev **sd; |
108 | /* vpfe cfg */ | 108 | /* vpfe cfg */ |