Message ID | 20230330115853.1628216-2-sakari.ailus@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Separate links and async sub-devices | expand |
Hi Sakari, On Thu, Mar 30, 2023 at 02:58:36PM +0300, Sakari Ailus wrote: > When an async notifier is unregistered, the async sub-devices in the > notifier's done list will disappear with the notifier. However this is > currently also done to the sub-notifiers that remain registered. Their > sub-devices only need to be unbound while the async sub-devices themselves > need to be returned to the sub-notifier's waiting list. Do this now. > > Fixes: 2cab00bb076b ("media: v4l: async: Allow binding notifiers to sub-devices") > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Thanks for clarifying my question on the RFC version Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Thanks j > --- > drivers/media/v4l2-core/v4l2-async.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index 2f1b718a9189..008a2a3e312e 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -414,7 +414,8 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd) > > /* Unbind all sub-devices in the notifier tree. */ > static void > -v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) > +v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier, > + bool readd) > { > struct v4l2_subdev *sd, *tmp; > > @@ -423,9 +424,11 @@ v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) > v4l2_async_find_subdev_notifier(sd); > > if (subdev_notifier) > - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); > + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, true); > > v4l2_async_nf_call_unbind(notifier, sd, sd->asd); > + if (readd) > + list_add_tail(&sd->asd->list, ¬ifier->waiting); > v4l2_async_cleanup(sd); > > list_move(&sd->async_list, &subdev_list); > @@ -557,7 +560,7 @@ static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier) > /* > * On failure, unbind all sub-devices registered through this notifier. > */ > - v4l2_async_nf_unbind_all_subdevs(notifier); > + v4l2_async_nf_unbind_all_subdevs(notifier, false); > > err_unlock: > mutex_unlock(&list_lock); > @@ -607,7 +610,7 @@ __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) > if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) > return; > > - v4l2_async_nf_unbind_all_subdevs(notifier); > + v4l2_async_nf_unbind_all_subdevs(notifier, false); > > notifier->sd = NULL; > notifier->v4l2_dev = NULL; > @@ -805,7 +808,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) > */ > subdev_notifier = v4l2_async_find_subdev_notifier(sd); > if (subdev_notifier) > - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); > + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, false); > > if (sd->asd) > v4l2_async_nf_call_unbind(notifier, sd, sd->asd); > -- > 2.30.2 >
Hi Sakari, Thank you for the patch. On Thu, Mar 30, 2023 at 02:58:36PM +0300, Sakari Ailus wrote: > When an async notifier is unregistered, the async sub-devices in the > notifier's done list will disappear with the notifier. However this is > currently also done to the sub-notifiers that remain registered. Their > sub-devices only need to be unbound while the async sub-devices themselves > need to be returned to the sub-notifier's waiting list. Do this now. > > Fixes: 2cab00bb076b ("media: v4l: async: Allow binding notifiers to sub-devices") > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > drivers/media/v4l2-core/v4l2-async.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index 2f1b718a9189..008a2a3e312e 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -414,7 +414,8 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd) > > /* Unbind all sub-devices in the notifier tree. */ > static void > -v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) > +v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier, > + bool readd) I've read this as "read d" and was wondering what it meant. Maybe "re_add" would be a better variable name ? Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > { > struct v4l2_subdev *sd, *tmp; > > @@ -423,9 +424,11 @@ v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) > v4l2_async_find_subdev_notifier(sd); > > if (subdev_notifier) > - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); > + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, true); > > v4l2_async_nf_call_unbind(notifier, sd, sd->asd); > + if (readd) > + list_add_tail(&sd->asd->list, ¬ifier->waiting); > v4l2_async_cleanup(sd); > > list_move(&sd->async_list, &subdev_list); > @@ -557,7 +560,7 @@ static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier) > /* > * On failure, unbind all sub-devices registered through this notifier. > */ > - v4l2_async_nf_unbind_all_subdevs(notifier); > + v4l2_async_nf_unbind_all_subdevs(notifier, false); > > err_unlock: > mutex_unlock(&list_lock); > @@ -607,7 +610,7 @@ __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) > if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) > return; > > - v4l2_async_nf_unbind_all_subdevs(notifier); > + v4l2_async_nf_unbind_all_subdevs(notifier, false); > > notifier->sd = NULL; > notifier->v4l2_dev = NULL; > @@ -805,7 +808,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) > */ > subdev_notifier = v4l2_async_find_subdev_notifier(sd); > if (subdev_notifier) > - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); > + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, false); > > if (sd->asd) > v4l2_async_nf_call_unbind(notifier, sd, sd->asd);
Hi Laurent, On Tue, Apr 25, 2023 at 04:28:57AM +0300, Laurent Pinchart wrote: > Hi Sakari, > > Thank you for the patch. > > On Thu, Mar 30, 2023 at 02:58:36PM +0300, Sakari Ailus wrote: > > When an async notifier is unregistered, the async sub-devices in the > > notifier's done list will disappear with the notifier. However this is > > currently also done to the sub-notifiers that remain registered. Their > > sub-devices only need to be unbound while the async sub-devices themselves > > need to be returned to the sub-notifier's waiting list. Do this now. > > > > Fixes: 2cab00bb076b ("media: v4l: async: Allow binding notifiers to sub-devices") > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > --- > > drivers/media/v4l2-core/v4l2-async.c | 13 ++++++++----- > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > > index 2f1b718a9189..008a2a3e312e 100644 > > --- a/drivers/media/v4l2-core/v4l2-async.c > > +++ b/drivers/media/v4l2-core/v4l2-async.c > > @@ -414,7 +414,8 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd) > > > > /* Unbind all sub-devices in the notifier tree. */ > > static void > > -v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) > > +v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier, > > + bool readd) > > I've read this as "read d" and was wondering what it meant. Maybe > "re_add" would be a better variable name ? > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Thank you. The patch has been already merged and the argument will soon disappear with the async rework patchset.
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 2f1b718a9189..008a2a3e312e 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -414,7 +414,8 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd) /* Unbind all sub-devices in the notifier tree. */ static void -v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) +v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier, + bool readd) { struct v4l2_subdev *sd, *tmp; @@ -423,9 +424,11 @@ v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier) v4l2_async_find_subdev_notifier(sd); if (subdev_notifier) - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, true); v4l2_async_nf_call_unbind(notifier, sd, sd->asd); + if (readd) + list_add_tail(&sd->asd->list, ¬ifier->waiting); v4l2_async_cleanup(sd); list_move(&sd->async_list, &subdev_list); @@ -557,7 +560,7 @@ static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier) /* * On failure, unbind all sub-devices registered through this notifier. */ - v4l2_async_nf_unbind_all_subdevs(notifier); + v4l2_async_nf_unbind_all_subdevs(notifier, false); err_unlock: mutex_unlock(&list_lock); @@ -607,7 +610,7 @@ __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) return; - v4l2_async_nf_unbind_all_subdevs(notifier); + v4l2_async_nf_unbind_all_subdevs(notifier, false); notifier->sd = NULL; notifier->v4l2_dev = NULL; @@ -805,7 +808,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) */ subdev_notifier = v4l2_async_find_subdev_notifier(sd); if (subdev_notifier) - v4l2_async_nf_unbind_all_subdevs(subdev_notifier); + v4l2_async_nf_unbind_all_subdevs(subdev_notifier, false); if (sd->asd) v4l2_async_nf_call_unbind(notifier, sd, sd->asd);
When an async notifier is unregistered, the async sub-devices in the notifier's done list will disappear with the notifier. However this is currently also done to the sub-notifiers that remain registered. Their sub-devices only need to be unbound while the async sub-devices themselves need to be returned to the sub-notifier's waiting list. Do this now. Fixes: 2cab00bb076b ("media: v4l: async: Allow binding notifiers to sub-devices") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/v4l2-core/v4l2-async.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)