media: exynos-gsc: Register v4l2 device
authorArun Kumar K <arun.kk@samsung.com>
Fri, 26 Jul 2013 10:28:01 +0000 (07:28 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Sep 2013 00:18:17 +0000 (17:18 -0700)
commit d0b1c31349969973204fad21a076aecf131cc5e4 upstream.

Gscaler video device registration was happening without reference to
a parent v4l2_dev causing probe to fail. The patch creates a parent
v4l2 device and uses it for the gsc m2m video device registration.
This fixes regression introduced with comit commit 1c1d86a1ea07506
[media] v4l2: always require v4l2_dev, rename parent to dev_parent

Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/exynos-gsc/gsc-core.c
drivers/media/platform/exynos-gsc/gsc-core.h
drivers/media/platform/exynos-gsc/gsc-m2m.c

index 33b5ffc8d66dfe136e2cd0df4129963b6c60ad79..f45b940d60721df6e57c85c69683f334e946c17c 100644 (file)
@@ -1122,10 +1122,14 @@ static int gsc_probe(struct platform_device *pdev)
                goto err_clk;
        }
 
-       ret = gsc_register_m2m_device(gsc);
+       ret = v4l2_device_register(dev, &gsc->v4l2_dev);
        if (ret)
                goto err_clk;
 
+       ret = gsc_register_m2m_device(gsc);
+       if (ret)
+               goto err_v4l2;
+
        platform_set_drvdata(pdev, gsc);
        pm_runtime_enable(dev);
        ret = pm_runtime_get_sync(&pdev->dev);
@@ -1147,6 +1151,8 @@ err_pm:
        pm_runtime_put(dev);
 err_m2m:
        gsc_unregister_m2m_device(gsc);
+err_v4l2:
+       v4l2_device_unregister(&gsc->v4l2_dev);
 err_clk:
        gsc_clk_put(gsc);
        return ret;
@@ -1157,6 +1163,7 @@ static int gsc_remove(struct platform_device *pdev)
        struct gsc_dev *gsc = platform_get_drvdata(pdev);
 
        gsc_unregister_m2m_device(gsc);
+       v4l2_device_unregister(&gsc->v4l2_dev);
 
        vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx);
        pm_runtime_disable(&pdev->dev);
index cc19bba09bd173720b2e8fc7b35813ea409da703..76435d3bf62d8a735c277c66724995ca78b8ab03 100644 (file)
@@ -343,6 +343,7 @@ struct gsc_dev {
        unsigned long                   state;
        struct vb2_alloc_ctx            *alloc_ctx;
        struct video_device             vdev;
+       struct v4l2_device              v4l2_dev;
 };
 
 /**
index 40a73f7d20daaefa006fa7afdef47e6ca529ef04..e576ff2de3de033cfc888d2afea783d72dfd93bb 100644 (file)
@@ -751,6 +751,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
        gsc->vdev.release       = video_device_release_empty;
        gsc->vdev.lock          = &gsc->lock;
        gsc->vdev.vfl_dir       = VFL_DIR_M2M;
+       gsc->vdev.v4l2_dev      = &gsc->v4l2_dev;
        snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m",
                                        GSC_MODULE_NAME, gsc->id);