* input: i8042 possible bug
@ 2013-09-03 17:39 Andrey Moiseev
2013-09-03 18:11 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Moiseev @ 2013-09-03 17:39 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov, linux-kernel
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?
> pr_err("No controller found\n");
> return -ENODEV;
> }
>
> return 0;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: input: i8042 possible bug
2013-09-03 17:39 input: i8042 possible bug Andrey Moiseev
@ 2013-09-03 18:11 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2013-09-03 18:11 UTC (permalink / raw)
To: Andrey Moiseev; +Cc: linux-input, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-03 18:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 17:39 input: i8042 possible bug Andrey Moiseev
2013-09-03 18:11 ` Dmitry Torokhov
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).