Re: [PATCH] HPET driver

From: Andrew Morton
Date: Wed Jun 23 2004 - 17:26:53 EST


Jeff Garzik <jgarzik@xxxxxxxxx> wrote:
>
> > I eliminated the request_irq brain damage, eliminated procfs support,
> > made the check for FMODE_WRITE in hpet_open and responded to a few
> > other suggestions.
>
> Thanks! I'll look over it too.

Here's one fixlet against Robert's fixes:



- Need to set TASK_INTERRUPTIBLE before checking devp->hd_irqdata.
Otherwise the wakeup from hpet_interrupt() could be missed.

Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

25-akpm/drivers/char/hpet.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)

diff -puN drivers/char/hpet.c~hpet-fixes-fix drivers/char/hpet.c
--- 25/drivers/char/hpet.c~hpet-fixes-fix Wed Jun 23 14:38:16 2004
+++ 25-akpm/drivers/char/hpet.c Wed Jun 23 14:38:16 2004
@@ -196,7 +196,8 @@ hpet_read(struct file *file, char *buf,

add_wait_queue(&devp->hd_waitqueue, &wait);

- do {
+ for ( ; ; ) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irq(&hpet_lock);
data = devp->hd_irqdata;
devp->hd_irqdata = 0;
@@ -211,17 +212,14 @@ hpet_read(struct file *file, char *buf,
retval = -ERESTARTSYS;
goto out;
}
-
- set_current_state(TASK_INTERRUPTIBLE);
schedule();
-
- } while (1);
+ }

retval = put_user(data, (unsigned long *)buf);
if (!retval)
retval = sizeof(unsigned long);
- out:
- current->state = TASK_RUNNING;
+out:
+ __set_current_state(TASK_RUNNING)
remove_wait_queue(&devp->hd_waitqueue, &wait);

return retval;
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/