From 1cd18f8e3da09c7bd80d2b0f8ebbb66d20d59bbf Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Wed, 13 Sep 2023 18:53:21 +0100
Subject: [PATCH 0493/1085] bcm2835-unicam: hacks to allow it to build

media: bcm2835-unicam: Fix up async notifier usage

Fixes "8a090fc3e549 bcm2835-unicam: hacks to allow it to build"
---
 drivers/media/platform/bcm2835/bcm2835-unicam.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
+++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
@@ -527,7 +527,7 @@ struct unicam_device {
 	struct kref kref;
 
 	/* V4l2 specific parameters */
-	struct v4l2_async_subdev asd;
+	struct v4l2_async_connection *asd;
 
 	/* peripheral base address */
 	void __iomem *base;
@@ -2802,7 +2802,7 @@ static const struct v4l2_file_operations
 static int
 unicam_async_bound(struct v4l2_async_notifier *notifier,
 		   struct v4l2_subdev *subdev,
-		   struct v4l2_async_subdev *asd)
+		   struct v4l2_async_connection *asd)
 {
 	struct unicam_device *unicam = to_unicam_device(notifier->v4l2_dev);
 
@@ -3335,18 +3335,18 @@ static int of_unicam_connect_subdevs(str
 		   dev->max_data_lanes, dev->bus_flags);
 
 	/* Initialize and register the async notifier. */
-	v4l2_async_nf_init(&dev->notifier);
+	v4l2_async_nf_init(&dev->notifier, &dev->v4l2_dev);
 	dev->notifier.ops = &unicam_async_ops;
 
-	dev->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-	dev->asd.match.fwnode = fwnode_graph_get_remote_endpoint(of_fwnode_handle(ep_node));
-	ret = __v4l2_async_nf_add_subdev(&dev->notifier, &dev->asd);
-	if (ret) {
+	dev->asd = v4l2_async_nf_add_fwnode(&dev->notifier,
+					    of_fwnode_handle(sensor_node),
+					    struct v4l2_async_connection);
+	if (IS_ERR(dev->asd)) {
 		unicam_err(dev, "Error adding subdevice: %d\n", ret);
 		goto cleanup_exit;
 	}
 
-	ret = v4l2_async_nf_register(&dev->v4l2_dev, &dev->notifier);
+	ret = v4l2_async_nf_register(&dev->notifier);
 	if (ret) {
 		unicam_err(dev, "Error registering async notifier: %d\n", ret);
 		ret = -EINVAL;
