[media] v4l: vsp1: Don't validate links when the userspace API is disabled
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 5 Aug 2015 20:14:41 +0000 (17:14 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 19 Feb 2016 11:26:15 +0000 (09:26 -0200)
As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
12 files changed:
drivers/media/platform/vsp1/vsp1.h
drivers/media/platform/vsp1/vsp1_bru.c
drivers/media/platform/vsp1/vsp1_drv.c
drivers/media/platform/vsp1/vsp1_entity.c
drivers/media/platform/vsp1/vsp1_entity.h
drivers/media/platform/vsp1/vsp1_hsit.c
drivers/media/platform/vsp1/vsp1_lif.c
drivers/media/platform/vsp1/vsp1_lut.c
drivers/media/platform/vsp1/vsp1_rpf.c
drivers/media/platform/vsp1/vsp1_sru.c
drivers/media/platform/vsp1/vsp1_uds.c
drivers/media/platform/vsp1/vsp1_wpf.c

index 4fd4386a704989154a320ff08f857becdf647344..454201bf59ee7c8d9864ef6978d723480426e5e0 100644 (file)
@@ -78,6 +78,8 @@ struct vsp1_device {
 
        struct v4l2_device v4l2_dev;
        struct media_device media_dev;
+
+       struct media_entity_operations media_ops;
 };
 
 int vsp1_device_get(struct vsp1_device *vsp1);
index baebfbbef61dfafca1329bb8698de9bcf5444da8..848bfb5a42ff33971ecf7634c6318cd2d77bd1d8 100644 (file)
@@ -424,7 +424,7 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
        subdev = &bru->entity.subdev;
        v4l2_subdev_init(subdev, &bru_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s bru",
                 dev_name(vsp1->dev));
index 63892b2f448406e338174a31d34392a734c5108b..1e10fc4723c5372129d4440f894ff71d701e2ab2 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
+#include <media/v4l2-subdev.h>
+
 #include "vsp1.h"
 #include "vsp1_bru.h"
 #include "vsp1_hsit.h"
@@ -214,6 +216,14 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
                 dev_name(mdev->dev));
        media_device_init(mdev);
 
+       vsp1->media_ops.link_setup = vsp1_entity_link_setup;
+       /* Don't perform link validation when the userspace API is disabled as
+        * the pipeline is configured internally by the driver in that case, and
+        * its configuration can thus be trusted.
+        */
+       if (vsp1->pdata.uapi)
+               vsp1->media_ops.link_validate = v4l2_subdev_link_validate;
+
        vdev->mdev = mdev;
        ret = v4l2_device_register(vsp1->dev, vdev);
        if (ret < 0) {
index 338a1b0b4fadedf80c0cc09bc43ae871a20fc642..03523899d7d0459c9f2f12c2cc5ad263cdf34876 100644 (file)
@@ -131,9 +131,9 @@ const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops = {
  * Media Operations
  */
 
-static int vsp1_entity_link_setup(struct media_entity *entity,
-                                 const struct media_pad *local,
-                                 const struct media_pad *remote, u32 flags)
+int vsp1_entity_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags)
 {
        struct vsp1_entity *source;
 
@@ -158,11 +158,6 @@ static int vsp1_entity_link_setup(struct media_entity *entity,
        return 0;
 }
 
-const struct media_entity_operations vsp1_media_ops = {
-       .link_setup = vsp1_entity_link_setup,
-       .link_validate = v4l2_subdev_link_validate,
-};
-
 /* -----------------------------------------------------------------------------
  * Initialization
  */
index 360a2e668ac2591bbe429e8539bf9bd3f8cce12a..83570dfde8eca9b2a11913a0c44128094dbb3b1a 100644 (file)
@@ -86,7 +86,10 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 void vsp1_entity_destroy(struct vsp1_entity *entity);
 
 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
-extern const struct media_entity_operations vsp1_media_ops;
+
+int vsp1_entity_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags);
 
 struct v4l2_mbus_framefmt *
 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
index 8ffb817ae5255809498f0716a6d91604ad31880c..c1087cff31a088b98b24a998bdf2d426ee883001 100644 (file)
@@ -203,7 +203,7 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse)
        subdev = &hsit->entity.subdev;
        v4l2_subdev_init(subdev, &hsit_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s %s",
                 dev_name(vsp1->dev), inverse ? "hsi" : "hst");
index b868bce08982624d41439ea96bc07e8ec2c98353..b8e73d32d14d8123bbd95799c38f8159bbc189d3 100644 (file)
@@ -223,7 +223,7 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1)
        subdev = &lif->entity.subdev;
        v4l2_subdev_init(subdev, &lif_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s lif",
                 dev_name(vsp1->dev));
index 9e33caa9c616cc4d212773226b99afb791e93418..4b89095e7b5fdd8a78722cd3a72e4c8d026ce919 100644 (file)
@@ -237,7 +237,7 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1)
        subdev = &lut->entity.subdev;
        v4l2_subdev_init(subdev, &lut_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s lut",
                 dev_name(vsp1->dev));
index b1d4a46f230eacbbc3f61efd766f3c067074eee7..3992da09e466ea768bb20f57443fa793504db556 100644 (file)
@@ -245,7 +245,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
        subdev = &rpf->entity.subdev;
        v4l2_subdev_init(subdev, &rpf_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s rpf.%u",
                 dev_name(vsp1->dev), index);
index cff4a1d82e3b62aed33ec020b6a606262b34f0d0..6dcf76a1ca572ac3fc9d8184ba714070ea58f40a 100644 (file)
@@ -363,7 +363,7 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
        subdev = &sru->entity.subdev;
        v4l2_subdev_init(subdev, &sru_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s sru",
                 dev_name(vsp1->dev));
index 27ad07466ebd0d13bc128f42ebc9c8f8431ed847..bba67770cf9567d6be4a0d0d9bb4377918c38026 100644 (file)
@@ -338,7 +338,7 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index)
        subdev = &uds->entity.subdev;
        v4l2_subdev_init(subdev, &uds_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s uds.%u",
                 dev_name(vsp1->dev), index);
index 40eeaf2d76d25dacc1fb2e46df9cef77d3d71a62..849ed81d86a1a921dc9eae2eb2060ecd430a4f81 100644 (file)
@@ -243,7 +243,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
        subdev = &wpf->entity.subdev;
        v4l2_subdev_init(subdev, &wpf_ops);
 
-       subdev->entity.ops = &vsp1_media_ops;
+       subdev->entity.ops = &vsp1->media_ops;
        subdev->internal_ops = &vsp1_subdev_internal_ops;
        snprintf(subdev->name, sizeof(subdev->name), "%s wpf.%u",
                 dev_name(vsp1->dev), index);