From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>, Ville Syrj?l? <syrjala@sci.fi>,
linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
Peter Stokes <linux@dadeos.co.uk>
Subject: Re: [PATCH 2/2] ati_remote2: Add autosuspend support
Date: Tue, 17 Jun 2008 13:53:56 -0400 [thread overview]
Message-ID: <20080617134137.ZZRA012@mailhub.coreip.homeip.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0806171316380.2652-100000@iolanthe.rowland.org>
On Tue, Jun 17, 2008 at 01:24:25PM -0400, Alan Stern wrote:
> On Tue, 17 Jun 2008, Dmitry Torokhov wrote:
>
> > On Tue, Jun 17, 2008 at 10:39:15AM -0400, Alan Stern wrote:
> > > On Tue, 17 Jun 2008, Dmitry Torokhov wrote:
> > >
> > > > Input core only protects open() and close(); connect() and
> > > > disconnect() belong to respective bus's implementation the device is
> > > > sitting on and input core has no authority over it.
> > >
> > > What about open vs. unregister? The input core must have some
> > > protection for those two.
> > >
> >
> > input_unregister_device() sets dev->going_away at the very beginning
> > and input_open_device() will fail with -ENODEV when trying to open such
> > devices. dev->going_away (among other things) is protected by
> > dev->mutex.
> >
> > Do you see any issues with this scheme?
>
> It depends on how much code is protected by dev->mutex.
>
> The real issue involving open vs. unregister comes down to this. It
> should not be possible for either:
>
> (1) an input_unregister_device() call to return while an
> input_open_device() call is in progress; or
Theoretically it is possible with wierd scheduling i guess. What I can
guarantee is that either input_open_device() fails or if it succeeds
input_close_device() will be called for the device at some point but
before input_unregister_device() returns. Does this help?
>
> (2) an input_open_device() call to be made after
> input_unregister_device() has returned.
As soon as input_unregister_device() starts executing
input_open_device() will start failing. Additionally, when
unregistering a device we forcefully disconnect all attached input
handlers so by the time input_unregister_device() is finished there
should be noone who can call input_open_device().
--
Dmitry
next prev parent reply other threads:[~2008-06-17 17:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 18:45 [PATCH 1/2] ati_remote2: Add loadable keymap support Ville Syrjala
2008-06-03 18:45 ` [PATCH 2/2] ati_remote2: Add autosuspend support Ville Syrjala
2008-06-03 20:11 ` Oliver Neukum
[not found] ` <200806032211.10052.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-06-04 8:20 ` Ville Syrjälä
2008-06-04 8:32 ` Oliver Neukum
[not found] ` <200806041032.58237.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-06-17 14:13 ` Dmitry Torokhov
2008-06-17 14:39 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.0806171038310.2513-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-06-17 15:28 ` Dmitry Torokhov
2008-06-17 17:24 ` Alan Stern
2008-06-17 17:53 ` Dmitry Torokhov [this message]
2008-06-17 18:52 ` Alan Stern
-- strict thread matches above, loose matches on Subject: below --
2008-06-25 10:56 [PATCH 0/2] ati_remote2 patches Ville Syrjala
2008-06-25 10:56 ` [PATCH 1/2] ati_remote2: Add loadable keymap support Ville Syrjala
[not found] ` <1214391371-13698-2-git-send-email-syrjala-ORSVBvAovxo@public.gmane.org>
2008-06-25 10:56 ` [PATCH 2/2] ati_remote2: Add autosuspend support Ville Syrjala
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=20080617134137.ZZRA012@mailhub.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@dadeos.co.uk \
--cc=oliver@neukum.org \
--cc=stern@rowland.harvard.edu \
--cc=syrjala@sci.fi \
/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).