[media] call media_device_init() before registering the V4L2 device
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 28 Dec 2015 11:24:23 +0000 (09:24 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:19:25 +0000 (12:19 -0200)
Currently, v4l2_device_register() doesn't use the media_device
struct. So, calling media_device_init() could be called either
before or after v4l2_device_register().

Yet, it is a good practice to initialize everything before calling
the register functions. Also, the other drivers call
media_device_init() before registering the V4L2 device.

So, move the call for media_device_init() to happen earlier on
exynos4-is and s3c-camif.

This is just a cleanup patch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/exynos4-is/media-dev.c
drivers/media/platform/s3c-camif/camif-core.c

index f6b391e795c6541032b027a4496933b2227cb24d..f3b2dd30ec7769b3199da9ed2694df5886004616 100644 (file)
@@ -1356,14 +1356,14 @@ static int fimc_md_probe(struct platform_device *pdev)
        fmd->use_isp = fimc_md_is_isp_available(dev->of_node);
        fmd->user_subdev_api = true;
 
+       media_device_init(&fmd->media_dev);
+
        ret = v4l2_device_register(dev, &fmd->v4l2_dev);
        if (ret < 0) {
                v4l2_err(v4l2_dev, "Failed to register v4l2_device: %d\n", ret);
                return ret;
        }
 
-       media_device_init(&fmd->media_dev);
-
        ret = fimc_md_get_clocks(fmd);
        if (ret)
                goto err_md;
index ea02b7ef2119ba6611bd2723608ac66e03fec6f7..0b44b9accf50794172ddb2249414883a1b125b43 100644 (file)
@@ -324,12 +324,12 @@ static int camif_media_dev_init(struct camif_dev *camif)
        strlcpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name));
        v4l2_dev->mdev = md;
 
+       media_device_init(md);
+
        ret = v4l2_device_register(camif->dev, v4l2_dev);
        if (ret < 0)
                return ret;
 
-       media_device_init(md);
-
        return ret;
 }