From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
linux-renesas-soc@vger.kernel.org,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Sylwester Nawrocki <snawrocki@kernel.org>
Subject: Re: [PATCH 1/4] v4l: async: fix unbind error in v4l2_async_notifier_unregister()
Date: Fri, 18 Aug 2017 15:42:07 +0200 [thread overview]
Message-ID: <20170818134207.GA8460@bigcity.dyn.berto.se> (raw)
In-Reply-To: <2638355.RUWT87hFr5@avalon>
Hi,
On 2017-08-18 14:15:26 +0300, Laurent Pinchart wrote:
> Hi Sakari,
>
> On Tuesday 15 Aug 2017 19:16:14 Sakari Ailus wrote:
> > On Mon, Jul 31, 2017 at 12:31:55AM +0200, Niklas Söderlund wrote:
> > > The call to v4l2_async_cleanup() will set sd->asd to NULL so passing it
> > > to notifier->unbind() have no effect and leaves the notifier confused.
> > > Call the unbind() callback prior to cleaning up the subdevice to avoid
> > > this.
> > >
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >
> > This is a bugfix and worthy without any other patches and so should be
> > applied separately.
> >
> > I think it'd be safer to store sd->asd locally and call the notifier unbind
> > with that. Now you're making changes to the order in which things work, and
> > that's not necessary to achieve the objective of passing the async subdev
> > pointer to the notifier.
>
> But on the other hand I think the unbind notification should be called before
> the subdevice gets unbound, the same way the bound notification is called
> after it gets bound. One of the purposes of the unbind notification is to
> allow drivers to prepare for subdev about to be unbound, and they can't
> prepare if the unbind happened already.
I'm not opposed to move in the direction suggested by Sakari but I agree
with Laurent here. It makes more sens that the unbind callback is called
before the actual unbind happens. At the same time I agree that it dose
change the behavior, but I think it's for the better.
>
> > With that changed,
> >
> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> >
> > > ---
> > >
> > > drivers/media/v4l2-core/v4l2-async.c | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/media/v4l2-core/v4l2-async.c
> > > b/drivers/media/v4l2-core/v4l2-async.c index
> > > 851f128eba2219ad..0acf288d7227ba97 100644
> > > --- a/drivers/media/v4l2-core/v4l2-async.c
> > > +++ b/drivers/media/v4l2-core/v4l2-async.c
> > > @@ -226,14 +226,14 @@ void v4l2_async_notifier_unregister(struct
> > > v4l2_async_notifier *notifier)>
> > > d = get_device(sd->dev);
> > >
> > > + if (notifier->unbind)
> > > + notifier->unbind(notifier, sd, sd->asd);
> > > +
> > >
> > > v4l2_async_cleanup(sd);
> > >
> > > /* If we handled USB devices, we'd have to lock the parent too
> */
> > > device_release_driver(d);
> > >
> > > - if (notifier->unbind)
> > > - notifier->unbind(notifier, sd, sd->asd);
> > > -
> > >
> > > /*
> > >
> > > * Store device at the device cache, in order to call
> > > * put_device() on the final step
>
> --
> Regards,
>
> Laurent Pinchart
>
--
Regards,
Niklas Söderlund
next prev parent reply other threads:[~2017-08-18 13:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-30 22:31 [PATCH 0/4] v4l: async: fixes for v4l2_async_notifier_unregister() Niklas Söderlund
2017-07-30 22:31 ` [PATCH 1/4] v4l: async: fix unbind error in v4l2_async_notifier_unregister() Niklas Söderlund
2017-08-15 16:16 ` Sakari Ailus
2017-08-18 11:15 ` Laurent Pinchart
2017-08-18 13:42 ` Niklas Söderlund [this message]
2017-08-18 13:49 ` Sakari Ailus
2017-08-18 11:13 ` Laurent Pinchart
2017-07-30 22:31 ` [PATCH 2/4] v4l: async: abort if memory allocation fails when unregistering notifiers Niklas Söderlund
2017-08-24 16:20 ` Sakari Ailus
2017-07-30 22:31 ` [PATCH 3/4] v4l: async: do not hold list_lock when re-probing devices Niklas Söderlund
2017-07-30 22:31 ` [PATCH 4/4] v4l: async: add comment about re-probing to v4l2_async_notifier_unregister() Niklas Söderlund
2017-08-15 16:09 ` Sakari Ailus
2017-08-18 11:20 ` Laurent Pinchart
2017-08-18 13:42 ` Niklas Söderlund
2017-08-23 19:03 ` Niklas Söderlund
2017-08-24 7:59 ` Hans Verkuil
2017-08-24 16:17 ` Sakari Ailus
2017-08-25 9:17 ` Hans Verkuil
2017-07-31 8:04 ` [PATCH 0/4] v4l: async: fixes for v4l2_async_notifier_unregister() Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170818134207.GA8460@bigcity.dyn.berto.se \
--to=niklas.soderlund@ragnatech.se \
--cc=hverkuil@xs4all.nl \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=sakari.ailus@iki.fi \
--cc=sakari.ailus@linux.intel.com \
--cc=snawrocki@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).