aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-02-26 06:01:48 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-11 08:23:10 -0400
commitf97881fe500026053c24d2a0ef8aebfd3c2a1ca8 (patch)
treea1414034e0efee56facc1203b1da0e6f1b89f10a
parent111eeaa73a10513ce47339445b1b164041a835b3 (diff)
[media] arv: fix sleep_on race
interruptible_sleep_on is racy and going away. In the arv driver that race has probably never caused problems since it would require a whole video frame to be captured before the read function has a chance to go to sleep, but using wait_event_interruptible lets us kill off the old interface. In order to do this, we have to slightly adapt the meaning of the ar->start_capture field to distinguish between not having started a frame and having completed it. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/arv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/arv.c b/drivers/media/platform/arv.c
index e346d32d08ce..e9410e41ae0c 100644
--- a/drivers/media/platform/arv.c
+++ b/drivers/media/platform/arv.c
@@ -109,7 +109,7 @@ extern struct cpuinfo_m32r boot_cpu_data;
109struct ar { 109struct ar {
110 struct v4l2_device v4l2_dev; 110 struct v4l2_device v4l2_dev;
111 struct video_device vdev; 111 struct video_device vdev;
112 unsigned int start_capture; /* duaring capture in INT. mode. */ 112 int start_capture; /* duaring capture in INT. mode. */
113#if USE_INT 113#if USE_INT
114 unsigned char *line_buff; /* DMA line buffer */ 114 unsigned char *line_buff; /* DMA line buffer */
115#endif 115#endif
@@ -307,11 +307,11 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
307 /* 307 /*
308 * Okay, kick AR LSI to invoke an interrupt 308 * Okay, kick AR LSI to invoke an interrupt
309 */ 309 */
310 ar->start_capture = 0; 310 ar->start_capture = -1;
311 ar_outl(arvcr1 | ARVCR1_HIEN, ARVCR1); 311 ar_outl(arvcr1 | ARVCR1_HIEN, ARVCR1);
312 local_irq_restore(flags); 312 local_irq_restore(flags);
313 /* .... AR interrupts .... */ 313 /* .... AR interrupts .... */
314 interruptible_sleep_on(&ar->wait); 314 wait_event_interruptible(ar->wait, ar->start_capture == 0);
315 if (signal_pending(current)) { 315 if (signal_pending(current)) {
316 printk(KERN_ERR "arv: interrupted while get frame data.\n"); 316 printk(KERN_ERR "arv: interrupted while get frame data.\n");
317 ret = -EINTR; 317 ret = -EINTR;