diff mbox series

[22/50] staging: media: imx: imx7-media-csi: Inline imx_media_pipeline_pad()

Message ID 20220510115859.19777-23-laurent.pinchart@ideasonboard.com
State Accepted
Commit 7d3bee233ce17ef55436e191890ae57774053379
Headers show
Series [01/50] staging: media: imx: imx7-media-csi: Initialize locks early on | expand

Commit Message

Laurent Pinchart May 10, 2022, 11:58 a.m. UTC
Inline the imx_media_pipeline_pad() helper, dropping all the code unused
by the imx7-media-csi driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 7e932884fd02..e1b494183ebc 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1605,7 +1605,8 @@  static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd,
 	struct imx7_csi *csi = v4l2_get_subdevdata(sd);
 	struct imx_media_video_dev *vdev = &csi->vdev;
 	const struct v4l2_pix_format *out_pix = &vdev->fmt;
-	struct media_pad *pad;
+	struct media_pad *pad = NULL;
+	unsigned int i;
 	int ret;
 
 	if (!csi->src_sd)
@@ -1627,7 +1628,17 @@  static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd,
 
 	case MEDIA_ENT_F_VID_MUX:
 		/* The input is the mux, check its input. */
-		pad = imx_media_pipeline_pad(&csi->src_sd->entity, 0, 0, true);
+		for (i = 0; i < csi->src_sd->entity.num_pads; i++) {
+			struct media_pad *spad = &csi->src_sd->entity.pads[i];
+
+			if (!(spad->flags & MEDIA_PAD_FL_SINK))
+				continue;
+
+			pad = media_entity_remote_pad(spad);
+			if (pad)
+				break;
+		}
+
 		if (!pad)
 			return -ENODEV;