diff mbox series

[RFC,3/4] media: v4l2-async: Call post_register() subdev op

Message ID 20210617171611.80542-4-jacopo+renesas@jmondi.org (mailing list archive)
State New, archived
Headers show
Series media: Introduce post_register() subdev operation | expand

Commit Message

Jacopo Mondi June 17, 2021, 5:16 p.m. UTC
Call the "post_register()" subdev operation on a just registered
subdevice, immediately after having called the 'bound' notifier
operation on the parent.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/v4l2-core/v4l2-async.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 0836e01e59ca..8656b50ee799 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -293,6 +293,16 @@  static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
 		return ret;
 	}
 
+	if (!(notifier->flags & V4L2_ASYNC_NOTIFIER_SKIP_POST_REGISTER) &&
+	    sd->ops->core && sd->ops->core->post_register) {
+		ret = sd->ops->core->post_register(sd);
+		if (ret) {
+			v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
+			v4l2_device_unregister_subdev(sd);
+			return ret;
+		}
+	}
+
 	/* Remove from the waiting list */
 	list_del(&asd->list);
 	sd->asd = asd;