Commit e0955e14 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: genrtc, use wait_event_interruptible

genrtc, use wait_event_interruptible
Signed-off-by: default avatarJiri Slaby <>
Cc: Alessandro Zummo <>
Cc: Roman Zippel <>
Cc: David Brownell <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 6804396f
......@@ -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) {
data = xchg(&gen_rtc_irq_data, 0);
if (data)
if (signal_pending(current))
goto out;
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);
remove_wait_queue(&gen_rtc_wait, &wait);
return retval;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment