aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorPatrick Boettcher <patrick.boettcher@desy.de>2005-08-27 13:30:30 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-27 14:03:45 -0400
commit8126fdbc76351bdf99c6737ef4fecf88a22fa538 (patch)
treec810f8f13be0e2eeec2f0bf9d92b21d746d3f15f /drivers/media
parent820d220de400cfaaf846a2d8b5de93f9ea5a9b80 (diff)
[PATCH] fix for race problem in DVB USB drivers (dibusb)
Fixed race between submitting streaming URBs in the driver and starting the actual transfer in hardware (demodulator and USB controller) which sometimes lead to garbled data transfers. URBs are now submitted first, then the transfer is enabled. Dibusb devices and clones are now fully functional again. Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c19
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c5
2 files changed, 17 insertions, 7 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 63b626f70c81..9b9d6f8ee74e 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -70,13 +70,22 @@ EXPORT_SYMBOL(dibusb_power_ctrl);
70 70
71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) 71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff)
72{ 72{
73 u8 b[2]; 73 u8 b[3] = { 0 };
74 b[0] = DIBUSB_REQ_SET_IOCTL; 74 int ret;
75 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; 75
76 if ((ret = dibusb_streaming_ctrl(d,onoff)) < 0)
77 return ret;
76 78
77 dvb_usb_generic_write(d,b,3); 79 if (onoff) {
80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
81 b[1] = 0x00;
82 if ((ret = dvb_usb_generic_write(d,b,2)) < 0)
83 return ret;
84 }
78 85
79 return dibusb_streaming_ctrl(d,onoff); 86 b[0] = DIBUSB_REQ_SET_IOCTL;
87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
88 return dvb_usb_generic_write(d,b,3);
80} 89}
81EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); 90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl);
82 91
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 3491ff40885c..6fa92100248b 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -23,12 +23,12 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
23 */ 23 */
24 if (newfeedcount == 0) { 24 if (newfeedcount == 0) {
25 deb_ts("stop feeding\n"); 25 deb_ts("stop feeding\n");
26 dvb_usb_urb_kill(d);
26 27
27 if (d->props.streaming_ctrl != NULL) 28 if (d->props.streaming_ctrl != NULL)
28 if ((ret = d->props.streaming_ctrl(d,0))) 29 if ((ret = d->props.streaming_ctrl(d,0)))
29 err("error while stopping stream."); 30 err("error while stopping stream.");
30 31
31 dvb_usb_urb_kill(d);
32 } 32 }
33 33
34 d->feedcount = newfeedcount; 34 d->feedcount = newfeedcount;
@@ -44,6 +44,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
44 * for reception. 44 * for reception.
45 */ 45 */
46 if (d->feedcount == onoff && d->feedcount > 0) { 46 if (d->feedcount == onoff && d->feedcount > 0) {
47 deb_ts("submitting all URBs\n");
48 dvb_usb_urb_submit(d);
47 49
48 deb_ts("controlling pid parser\n"); 50 deb_ts("controlling pid parser\n");
49 if (d->props.caps & DVB_USB_HAS_PID_FILTER && 51 if (d->props.caps & DVB_USB_HAS_PID_FILTER &&
@@ -59,7 +61,6 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
59 return -ENODEV; 61 return -ENODEV;
60 } 62 }
61 63
62 dvb_usb_urb_submit(d);
63 } 64 }
64 return 0; 65 return 0;
65} 66}