Commit 9d63cec1 authored by Dean Anderson's avatar Dean Anderson Committed by Mauro Carvalho Chehab

V4L/DVB (11570): patch: s2255drv: fix race condition on set mode

set_modeready flag must be set before command sent to USB in
s2255_write_config.
Signed-off-by: default avatarDean Anderson <dean@sensoray.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 272aa396
...@@ -1237,6 +1237,7 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, ...@@ -1237,6 +1237,7 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn,
buffer[1] = (u32) chn_rev; buffer[1] = (u32) chn_rev;
buffer[2] = CMD_SET_MODE; buffer[2] = CMD_SET_MODE;
memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_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); res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512);
if (debug) if (debug)
dump_verify_mode(dev, mode); dump_verify_mode(dev, mode);
...@@ -1245,7 +1246,6 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, ...@@ -1245,7 +1246,6 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn,
/* wait at least 3 frames before continuing */ /* wait at least 3 frames before continuing */
if (mode->restart) { if (mode->restart) {
dev->setmode_ready[chn] = 0;
wait_event_timeout(dev->wait_setmode[chn], wait_event_timeout(dev->wait_setmode[chn],
(dev->setmode_ready[chn] != 0), (dev->setmode_ready[chn] != 0),
msecs_to_jiffies(S2255_SETMODE_TIMEOUT)); msecs_to_jiffies(S2255_SETMODE_TIMEOUT));
......
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