mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
Char: genrtc, use wait_event_interruptible
genrtc, use wait_event_interruptible Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6804396f1b
commit
e0955e14f7
@ -173,7 +173,6 @@ static void gen_rtc_interrupt(unsigned long arg)
|
|||||||
static ssize_t gen_rtc_read(struct file *file, char __user *buf,
|
static ssize_t gen_rtc_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
|
||||||
unsigned long data;
|
unsigned long data;
|
||||||
ssize_t retval;
|
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)
|
if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
add_wait_queue(&gen_rtc_wait, &wait);
|
retval = wait_event_interruptible(gen_rtc_wait,
|
||||||
retval = -ERESTARTSYS;
|
(data = xchg(&gen_rtc_irq_data, 0)));
|
||||||
|
if (retval)
|
||||||
while (1) {
|
goto out;
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
|
||||||
data = xchg(&gen_rtc_irq_data, 0);
|
|
||||||
if (data)
|
|
||||||
break;
|
|
||||||
if (signal_pending(current))
|
|
||||||
goto out;
|
|
||||||
schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* first test allows optimizer to nuke this case for 32-bit machines */
|
/* first test allows optimizer to nuke this case for 32-bit machines */
|
||||||
if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) {
|
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) ?:
|
retval = put_user(data, (unsigned long __user *)buf) ?:
|
||||||
sizeof(unsigned long);
|
sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
__set_current_state(TASK_RUNNING);
|
|
||||||
remove_wait_queue(&gen_rtc_wait, &wait);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user