Skip to contentSkip to conversation

media: updating error codes on streamon

PATCH New Helen Mae Koike Fornazier 1 participant 3 messages Mar 30, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover media: updating error codes on streamon

Fix error code on streamon

Changes since v3:

[media] media: change pipeline validation return error
* Nothing has changed
[media] DocBook: update error code in videoc-streamon
* Added "link" word
* Added Ack-by

The patch set is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Helen Mae Koike Fornazier (2):
[media] media: change pipeline validation return error [media] DocBook: update error code in videoc-streamon

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 ++++++++
 drivers/media/media-entity.c                        | 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c               | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/2 media: change pipeline validation return error

According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE if there is a format mismatch in the pipeline configuration.

As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error caused by the v4l2_subdev_link_validate_default (if it is in use), it should return -EPIPE when it detect the mismatch.

When an entity is connected to a non enabled link, media_entity_pipeline_start should return -ENOLINK, as the link does not exist.

---

Nothing has changed since v3

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

 drivers/media/media-entity.c          | 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/media-entity.c +1 -1
index c53c1d5..d8a2299 100644
@@ -445,7 +445,7 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity,
 		bitmap_or(active, active, has_no_links, entity->num_pads);
 
 		if (!bitmap_full(active, entity->num_pads)) {
-			ret = -EPIPE;
+			ret = -ENOLINK;
 			dev_dbg(entity->graph_obj.mdev->dev,
 				"\"%s\":%u must be connected by an enabled link\n",
 				entity->name,
drivers/media/v4l2-core/v4l2-subdev.c +2 -2
index d630838..918e79d 100644
@@ -508,7 +508,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
 	if (source_fmt->format.width != sink_fmt->format.width
 	    || source_fmt->format.height != sink_fmt->format.height
 	    || source_fmt->format.code != sink_fmt->format.code)
-		return -EINVAL;
+		return -EPIPE;
 
 	/* The field order must match, or the sink field order must be NONE
 	 * to support interlaced hardware connected to bridges that support
@@ -516,7 +516,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
 	 */
 	if (source_fmt->format.field != sink_fmt->format.field &&
 	    sink_fmt->format.field != V4L2_FIELD_NONE)
-		return -EINVAL;
+		return -EPIPE;
 
 	return 0;
 }
Signature · 1 line
1.9.1
#2 lore raw

PATCH v4 2/2 DocBook: update error code in videoc-streamon

In reply to Helen Mae Koike Fornazier

Add description of ENOLINK error

---

Changes since v3:
* ..."pipeline configuration"... to ..."pipeline link configuration"...
* Added Acked-by

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/DocBook/media/v4l/vidioc-streamon.xml +8 -0
index df2c63d..89fd7ce 100644
@@ -123,6 +123,14 @@ synchronize with other events.</para>
 	  </para>
 	</listitem>
       </varlistentry>
+      <varlistentry>
+	<term><errorcode>ENOLINK</errorcode></term>
+	<listitem>
+	  <para>The driver implements Media Controller interface and
+	  the pipeline link configuration is invalid.
+	  </para>
+	</listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 </refentry>
Signature · 1 line
1.9.1