This will be reused in the following patch to catch already registered,
newly added asynchronous subdevices from v4l2_async_register_subdev.

Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
Changes since v1:
 - Add missing v4l2_async_test_notify_all() call.
---
 drivers/media/v4l2-core/v4l2-async.c | 38 ++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 5bada20..1113df4 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -134,11 +134,31 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd)
        sd->dev = NULL;
 }
 
+static int v4l2_async_test_notify_all(struct v4l2_async_notifier *notifier)
+{
+       struct v4l2_subdev *sd, *tmp;
+
+       list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) {
+               struct v4l2_async_subdev *asd;
+               int ret;
+
+               asd = v4l2_async_belongs(notifier, sd);
+               if (!asd)
+                       continue;
+
+               ret = v4l2_async_test_notify(notifier, sd, asd);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
+}
+
 int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
                                 struct v4l2_async_notifier *notifier)
 {
-       struct v4l2_subdev *sd, *tmp;
        struct v4l2_async_subdev *asd;
+       int ret;
        int i;
 
        if (!notifier->num_subdevs || notifier->num_subdevs > V4L2_MAX_SUBDEVS)
@@ -171,23 +191,11 @@ int v4l2_async_notifier_register(struct v4l2_device 
*v4l2_dev,
        /* Keep also completed notifiers on the list */
        list_add(&notifier->list, &notifier_list);
 
-       list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) {
-               int ret;
-
-               asd = v4l2_async_belongs(notifier, sd);
-               if (!asd)
-                       continue;
-
-               ret = v4l2_async_test_notify(notifier, sd, asd);
-               if (ret < 0) {
-                       mutex_unlock(&list_lock);
-                       return ret;
-               }
-       }
+       ret = v4l2_async_test_notify_all(notifier);
 
        mutex_unlock(&list_lock);
 
-       return 0;
+       return ret;
 }
 EXPORT_SYMBOL(v4l2_async_notifier_register);
 
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to