Commit 026e6212 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: omap3isp: Move link creation to bound callback



Move the creation of the links between external sub-devices and ISP
sub-devices to the bound callback. This way we can also remove the need to
access the sub-device's notifier field that will soon be removed.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 64585805
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -2022,35 +2022,34 @@ enum isp_of_phy {
	ISP_OF_PHY_CSIPHY2,
};

static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async,
				     struct v4l2_subdev *sd,
				     struct v4l2_async_subdev *asd)
{
	struct isp_device *isp = container_of(async, struct isp_device,
					      notifier);
	struct v4l2_device *v4l2_dev = &isp->v4l2_dev;
	struct v4l2_subdev *sd;
	struct isp_bus_cfg *bus_cfg =
		&container_of(asd, struct isp_async_subdev, asd)->bus;
	int ret;

	mutex_lock(&isp->media_dev.graph_mutex);

	ret = media_entity_enum_init(&isp->crashed, &isp->media_dev);
	if (ret) {
	ret = isp_link_entity(isp, &sd->entity, bus_cfg->interface);
	mutex_unlock(&isp->media_dev.graph_mutex);

	return ret;
}

	list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
		if (sd->notifier != &isp->notifier)
			continue;
static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
{
	struct isp_device *isp = container_of(async, struct isp_device,
					      notifier);
	int ret;

		ret = isp_link_entity(isp, &sd->entity,
				      v4l2_subdev_to_bus_cfg(sd)->interface);
		if (ret < 0) {
	mutex_lock(&isp->media_dev.graph_mutex);
	ret = media_entity_enum_init(&isp->crashed, &isp->media_dev);
	mutex_unlock(&isp->media_dev.graph_mutex);
	if (ret)
		return ret;
		}
	}

	mutex_unlock(&isp->media_dev.graph_mutex);

	ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
	if (ret < 0)
@@ -2240,6 +2239,7 @@ static int isp_parse_of_endpoints(struct isp_device *isp)
}

static const struct v4l2_async_notifier_operations isp_subdev_notifier_ops = {
	.bound = isp_subdev_notifier_bound,
	.complete = isp_subdev_notifier_complete,
};