diff mbox

[04/20] v4l2-core: check that both pads in a link are muxed if one are

Message ID 20170811095703.6170-5-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show

Commit Message

Niklas Söderlund Aug. 11, 2017, 9:56 a.m. UTC
Since multiplexed pads carry multiple streams it's not possible to
verify the format for a specific stream at this time. Instead make sure
both pads are marked as multiplexed and skip the format checking.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 43fefa73e0a3f64f..d6c1a3b777dd2fcd 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -547,6 +547,15 @@  int v4l2_subdev_link_validate(struct media_link *link)
 	struct v4l2_subdev_format sink_fmt, source_fmt;
 	int rval;
 
+	/* Require both pads in a link to be multiplexed if one is */
+	if ((link->source->flags | link->sink->flags) & MEDIA_PAD_FL_MUXED) {
+		if ((link->source->flags & MEDIA_PAD_FL_MUXED) == 0)
+			return -EINVAL;
+		if ((link->sink->flags & MEDIA_PAD_FL_MUXED) == 0)
+			return -EINVAL;
+		return 0;
+	}
+
 	rval = v4l2_subdev_link_validate_get_format(
 		link->source, &source_fmt);
 	if (rval < 0)