aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-07-16 02:40:19 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:44 -0400
commite0955e14f72dd1f561dc8b7c4434a253914ddfd4 (patch)
tree0a5cc911207d0bf710dbc4d3896e808e631ff1ec /drivers
parent6804396f1b66c504bac1267d71a857f7a1d1e9dd (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/genrtc.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 9e1fc02967ff..69f0a2993af0 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -173,7 +173,6 @@ static void gen_rtc_interrupt(unsigned long arg)
173static ssize_t gen_rtc_read(struct file *file, char __user *buf, 173static ssize_t gen_rtc_read(struct file *file, char __user *buf,
174 size_t count, loff_t *ppos) 174 size_t count, loff_t *ppos)
175{ 175{
176 DECLARE_WAITQUEUE(wait, current);
177 unsigned long data; 176 unsigned long data;
178 ssize_t retval; 177 ssize_t retval;
179 178
@@ -183,18 +182,10 @@ static ssize_t gen_rtc_read(struct file *file, char __user *buf,
183 if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data) 182 if (file->f_flags & O_NONBLOCK && !gen_rtc_irq_data)
184 return -EAGAIN; 183 return -EAGAIN;
185 184
186 add_wait_queue(&gen_rtc_wait, &wait); 185 retval = wait_event_interruptible(gen_rtc_wait,
187 retval = -ERESTARTSYS; 186 (data = xchg(&gen_rtc_irq_data, 0)));
188 187 if (retval)
189 while (1) { 188 goto out;
190 set_current_state(TASK_INTERRUPTIBLE);
191 data = xchg(&gen_rtc_irq_data, 0);
192 if (data)
193 break;
194 if (signal_pending(current))
195 goto out;
196 schedule();
197 }
198 189
199 /* first test allows optimizer to nuke this case for 32-bit machines */ 190 /* first test allows optimizer to nuke this case for 32-bit machines */
200 if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) { 191 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,
206 retval = put_user(data, (unsigned long __user *)buf) ?: 197 retval = put_user(data, (unsigned long __user *)buf) ?:
207 sizeof(unsigned long); 198 sizeof(unsigned long);
208 } 199 }
209 out: 200out:
210 __set_current_state(TASK_RUNNING);
211 remove_wait_queue(&gen_rtc_wait, &wait);
212
213 return retval; 201 return retval;
214} 202}
215 203