diff mbox

patch: s2255drv: fix race condition on set mode

Message ID tkrat.21210659c895a1d2@sensoray.com (mailing list archive)
State Accepted
Headers show

Commit Message

Dean Anderson April 20, 2009, 10:07 p.m. UTC
From: Dean Anderson <dean@sensoray.com>

set_modeready flag must be set before command sent to USB in
s2255_write_config.

Signed-off-by: Dean Anderson <dean@sensoray.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- v4l-dvb-74b7f650670a/linux/drivers/media/video/s2255drv.c.orig	2009-04-20 14:33:04.000000000 -0700
+++ v4l-dvb-74b7f650670a/linux/drivers/media/video/s2255drv.c	2009-04-20 14:58:22.000000000 -0700
@@ -1238,6 +1238,7 @@  static int s2255_set_mode(struct s2255_d
 	buffer[1] = (u32) chn_rev;
 	buffer[2] = CMD_SET_MODE;
 	memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_mode));
+	dev->setmode_ready[chn] = 0;
 	res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512);
 	if (debug)
 		dump_verify_mode(dev, mode);
@@ -1246,7 +1247,6 @@  static int s2255_set_mode(struct s2255_d
 
 	/* wait at least 3 frames before continuing */
 	if (mode->restart) {
-		dev->setmode_ready[chn] = 0;
 		wait_event_timeout(dev->wait_setmode[chn],
 				   (dev->setmode_ready[chn] != 0),
 				   msecs_to_jiffies(S2255_SETMODE_TIMEOUT));