diff mbox series

[1/3] media: ipu3-cio2: Further clean up async subdev link creation

Message ID 20231221135822.152448-2-sakari.ailus@linux.intel.com (mailing list archive)
State New
Headers show
Series Miscellaneous small things | expand

Commit Message

Sakari Ailus Dec. 21, 2023, 1:58 p.m. UTC
Use v4l2_create_fwnode_links_to_pad() to create links from async
sub-devices to the CSI-2 receiver subdevs.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

Comments

Laurent Pinchart Dec. 21, 2023, 4:57 p.m. UTC | #1
Hi Sakari,

Thank you for the patch.

On Thu, Dec 21, 2023 at 03:58:20PM +0200, Sakari Ailus wrote:
> Use v4l2_create_fwnode_links_to_pad() to create links from async
> sub-devices to the CSI-2 receiver subdevs.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC

This doesn't look right, I don't think this patch could have been
meaningfully tested on a Renesas platform :-) With the line dropped,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++-----------------
>  1 file changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index ed08bf4178f0..83e29c56fe33 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -28,6 +28,7 @@
>  #include <media/v4l2-device.h>
>  #include <media/v4l2-event.h>
>  #include <media/v4l2-fwnode.h>
> +#include <media/v4l2-mc.h>
>  #include <media/v4l2-ioctl.h>
>  #include <media/videobuf2-dma-sg.h>
>  
> @@ -1407,7 +1408,6 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
>  static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
>  {
>  	struct cio2_device *cio2 = to_cio2_device(notifier);
> -	struct device *dev = &cio2->pci_dev->dev;
>  	struct sensor_async_subdev *s_asd;
>  	struct v4l2_async_connection *asd;
>  	struct cio2_queue *q;
> @@ -1417,23 +1417,10 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
>  		s_asd = to_sensor_asd(asd);
>  		q = &cio2->queue[s_asd->csi2.port];
>  
> -		ret = media_entity_get_fwnode_pad(&q->sensor->entity,
> -						  s_asd->asd.match.fwnode,
> -						  MEDIA_PAD_FL_SOURCE);
> -		if (ret < 0) {
> -			dev_err(dev, "no pad for endpoint %pfw (%d)\n",
> -				s_asd->asd.match.fwnode, ret);
> -			return ret;
> -		}
> -
> -		ret = media_create_pad_link(&q->sensor->entity, ret,
> -					    &q->subdev.entity, CIO2_PAD_SINK,
> -					    0);
> -		if (ret) {
> -			dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n",
> -				q->sensor->name, s_asd->asd.match.fwnode, ret);
> +		ret = v4l2_create_fwnode_links_to_pad(asd->sd,
> +						      &q->subdev_pads[CIO2_PAD_SINK], 0);
> +		if (ret)
>  			return ret;
> -		}
>  	}
>  
>  	return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
> @@ -1572,6 +1559,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q)
>  	v4l2_subdev_init(subdev, &cio2_subdev_ops);
>  	subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
>  	subdev->owner = THIS_MODULE;
> +	subdev->dev = dev;
>  	snprintf(subdev->name, sizeof(subdev->name),
>  		 CIO2_ENTITY_NAME " %td", q - cio2->queue);
>  	subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
Sakari Ailus Dec. 21, 2023, 6:30 p.m. UTC | #2
Hi Laurent,

On Thu, Dec 21, 2023 at 06:57:23PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> On Thu, Dec 21, 2023 at 03:58:20PM +0200, Sakari Ailus wrote:
> > Use v4l2_create_fwnode_links_to_pad() to create links from async
> > sub-devices to the CSI-2 receiver subdevs.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
> 
> This doesn't look right, I don't think this patch could have been
> meaningfully tested on a Renesas platform :-) With the line dropped,

Oops. I intended to remove this but forgot... The patch used to be in a
branch that hosted a patchset tested by Prabhakar and adding the Tested-by:
mistakenly was applied to this patch by a script.

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thanks!
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index ed08bf4178f0..83e29c56fe33 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -28,6 +28,7 @@ 
 #include <media/v4l2-device.h>
 #include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
+#include <media/v4l2-mc.h>
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-dma-sg.h>
 
@@ -1407,7 +1408,6 @@  static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
 static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
 {
 	struct cio2_device *cio2 = to_cio2_device(notifier);
-	struct device *dev = &cio2->pci_dev->dev;
 	struct sensor_async_subdev *s_asd;
 	struct v4l2_async_connection *asd;
 	struct cio2_queue *q;
@@ -1417,23 +1417,10 @@  static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
 		s_asd = to_sensor_asd(asd);
 		q = &cio2->queue[s_asd->csi2.port];
 
-		ret = media_entity_get_fwnode_pad(&q->sensor->entity,
-						  s_asd->asd.match.fwnode,
-						  MEDIA_PAD_FL_SOURCE);
-		if (ret < 0) {
-			dev_err(dev, "no pad for endpoint %pfw (%d)\n",
-				s_asd->asd.match.fwnode, ret);
-			return ret;
-		}
-
-		ret = media_create_pad_link(&q->sensor->entity, ret,
-					    &q->subdev.entity, CIO2_PAD_SINK,
-					    0);
-		if (ret) {
-			dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n",
-				q->sensor->name, s_asd->asd.match.fwnode, ret);
+		ret = v4l2_create_fwnode_links_to_pad(asd->sd,
+						      &q->subdev_pads[CIO2_PAD_SINK], 0);
+		if (ret)
 			return ret;
-		}
 	}
 
 	return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
@@ -1572,6 +1559,7 @@  static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q)
 	v4l2_subdev_init(subdev, &cio2_subdev_ops);
 	subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
 	subdev->owner = THIS_MODULE;
+	subdev->dev = dev;
 	snprintf(subdev->name, sizeof(subdev->name),
 		 CIO2_ENTITY_NAME " %td", q - cio2->queue);
 	subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;