[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130903181134.GD25985@core.coreip.homeip.net>
Date: Tue, 3 Sep 2013 11:11:35 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Andrey Moiseev <o2g.org.ru@...il.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: input: i8042 possible bug
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists