From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrey Moiseev <o2g.org.ru@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: input: i8042 possible bug
Date: Tue, 3 Sep 2013 11:11:35 -0700 [thread overview]
Message-ID: <20130903181134.GD25985@core.coreip.homeip.net> (raw)
In-Reply-To: <52261EBE.5010007@gmail.com>
On Tue, Sep 03, 2013 at 09:39:10PM +0400, Andrey Moiseev wrote:
> Here is an extract from drivers/input/serio/i8042.c:
> >
> > static int i8042_flush(void)
> > {
> > unsigned long flags;
> > unsigned char data, str;
> > int i = 0;
> >
> > spin_lock_irqsave(&i8042_lock, flags);
> >
> > while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) {
> > udelay(50);
> > data = i8042_read_data();
> > i++;
> > dbg("%02x <- i8042 (flush, %s)\n",
> > data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
> > }
> >
> > spin_unlock_irqrestore(&i8042_lock, flags);
> >
> > return i;
> > }
> >
> > static int i8042_controller_check(void)
> > {
> > if (i8042_flush() == I8042_BUFFER_SIZE) {
> Doesn't it panic needlessly, while the buffer was initially full?
It appears so. We probably want to change it to return -1 if we still
see OBF after fetching I8042_BUFFER_SIZE characters.
Thanks.
--
Dmitry
prev parent reply other threads:[~2013-09-03 18:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 17:39 input: i8042 possible bug Andrey Moiseev
2013-09-03 18:11 ` 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=20130903181134.GD25985@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=o2g.org.ru@gmail.com \
/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).