[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <24123155773117716452@wsc.cz>
Date: Mon, 28 May 2007 15:28:26 +0200 (CEST)
From: Jiri Slaby <jirislaby@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: <rz@...ux-m68k.org>
Subject: [PATCH 4/8] Char: genrtc, use wait_event_interruptible
genrtc, use wait_event_interruptible
Signed-off-by: Jiri Slaby <jirislaby@...il.com>
---
commit d45ae897fff813cf27d5d6ddfd92d19806831965
tree 8c985cb371c7d22c4ae939b27fe56705274452dc
parent 68362b19a0b8b05ce81b8d17743f2d0fceedb81b
author Jiri Slaby <jirislaby@...il.com> Sat, 26 May 2007 21:26:32 +0200
committer Jiri Slaby <jirislaby@...il.com> Sat, 26 May 2007 21:26:32 +0200
drivers/char/genrtc.c | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 9e1fc02..69f0a29 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -173,7 +173,6 @@ static void gen_rtc_interrupt(unsigned long arg)
static ssize_t gen_rtc_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
- DECLARE_WAITQUEUE(wait, current);
unsigned long data;
ssize_t retval;
@@ -183,18 +182,10 @@ static ssize_t gen_rtc_read(struct file *file, char __user *buf,
if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data)
return -EAGAIN;
- add_wait_queue(&gen_rtc_wait, &wait);
- retval = -ERESTARTSYS;
-
- while (1) {
- set_current_state(TASK_INTERRUPTIBLE);
- data = xchg(&gen_rtc_irq_data, 0);
- if (data)
- break;
- if (signal_pending(current))
- goto out;
- schedule();
- }
+ retval = wait_event_interruptible(gen_rtc_wait,
+ (data = xchg(&gen_rtc_irq_data, 0)));
+ if (retval)
+ goto out;
/* first test allows optimizer to nuke this case for 32-bit machines */
if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) {
@@ -206,10 +197,7 @@ static ssize_t gen_rtc_read(struct file *file, char __user *buf,
retval = put_user(data, (unsigned long __user *)buf) ?:
sizeof(unsigned long);
}
- out:
- __set_current_state(TASK_RUNNING);
- remove_wait_queue(&gen_rtc_wait, &wait);
-
+out:
return retval;
}
-
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