linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Duncan Laurie <dlaurie@chromium.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: serio - clear serio event queue after sysfs driver rebind
Date: Wed, 2 Feb 2011 14:58:42 -0800	[thread overview]
Message-ID: <20110202225842.GA25306@core.coreip.homeip.net> (raw)
In-Reply-To: <AANLkTiknhubSN37ChYebWxd9Wx=R4dN38ETdZv2BZYee@mail.gmail.com>

On Wed, Feb 02, 2011 at 02:41:38PM -0800, Duncan Laurie wrote:
> On Tue, Feb 1, 2011 at 1:21 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Tue, Dec 07, 2010 at 09:12:11PM -0800, Dmitry Torokhov wrote:
> >> On Mon, Nov 29, 2010 at 01:37:35PM -0800, Duncan Laurie wrote:
> >> > On Sat, Nov 27, 2010 at 12:41 AM, Dmitry Torokhov
> >> > <dmitry.torokhov@gmail.com> wrote:
> >> > > Hi Duncan,
> >> > >
> >> > > On Mon, Nov 22, 2010 at 03:09:50PM -0800, Duncan Laurie wrote:
> >> > >> When rebinding a serio driver via sysfs drvctl interface it is possible for
> >> > >> an interrupt to trigger after the disconnect of the existing driver and
> >> > >> before the binding of the new driver.  This will cause the serio interrupt
> >> > >> handler to queue a rescan event which will disconnect the new driver
> >> > >> immediately after it is attached.
> >> > >>
> >> > >> This change clears the serio event queue after processing the drvctl
> >> > >> request but before releasing the serio mutex, which will clear any queued
> >> > >> rescans before they can get processed.
> >> > >>
> >> > >> Reproduction involves issuing a rebind of device port from psmouse driver
> >> > >> to serio_raw driver while generating input to trigger interrupts.  Then
> >> > >> checking to see if the corresponding i8042/serio4/driver is correctly
> >> > >> attached to the serio_raw driver instead of psmouse.
> >> > >>
> >> > >> Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
> >> > >> ---
> >> > >>  drivers/input/serio/serio.c |    1 +
> >> > >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >> > >>
> >> > >> diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
> >> > >> index 405bf21..a66307e 100644
> >> > >> --- a/drivers/input/serio/serio.c
> >> > >> +++ b/drivers/input/serio/serio.c
> >> > >> @@ -454,6 +454,7 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *
> >> > >>               serio_disconnect_port(serio);
> >> > >>               error = serio_bind_driver(serio, to_serio_driver(drv));
> >> > >>               put_driver(drv);
> >> > >> +             serio_remove_pending_events(serio);
> >> > >
> >> > > Hmm, makes sense, although should we limit events being removed to
> >> > > rescan events only?
> >> > >
> >> >
> >> >
> >> > That seems reasonable.  It would mean adding a new function or a
> >> > parameter to the existing serio_remove_pending_events function, do you
> >> > have a preference?
> >> >
> >>
> >> I wonder if a boolean parameter (rescan_only) would not be the best
> >> option.
> >>
> >
> > Hi Duncan,
> >
> > I eneded up with the following patch, could you please try and see if
> > it still works for you?
> >
> 
> 
> Hi Dmitry,
> 
> I tested the patch on a CR-48 device (which is where I was seeing the
> problem because we switch to serio_raw at boot for the trackpad) and
> it does fix the problem.
> 
> Thanks for sending this, it had slipped off my todo list.
> 

Great, thank you for testing.

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

      reply	other threads:[~2011-02-02 22:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 23:09 [PATCH] Input: serio - clear serio event queue after sysfs driver rebind Duncan Laurie
2010-11-27  8:41 ` Dmitry Torokhov
2010-11-29 21:37   ` Duncan Laurie
2010-12-08  5:12     ` Dmitry Torokhov
2011-02-01  9:21       ` Dmitry Torokhov
2011-02-02 22:41         ` Duncan Laurie
2011-02-02 22:58           ` Dmitry Torokhov [this message]

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=20110202225842.GA25306@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=dlaurie@chromium.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.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).