diff mbox

Remove stream pipe draining code for CXUSB D680 DMB

Message ID 15ed362e0903170900y6a71cb71oc65768367a8cfd14@mail.gmail.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

David Wong March 17, 2009, 4 p.m. UTC
CXUSB D680 DMB pipe draining code found to be problematic for new
kernels (eg. kernel 2.6.27 @ Ubuntu 8.10)

David T.L. Wong

Comments

Mauro Carvalho Chehab March 27, 2009, 10:07 a.m. UTC | #1
On Wed, 18 Mar 2009 00:00:10 +0800
David Wong <davidtlwong@gmail.com> wrote:

> CXUSB D680 DMB pipe draining code found to be problematic for new
> kernels (eg. kernel 2.6.27 @ Ubuntu 8.10)

Could you please provide a clearer description? Why is it problematic? Also,
please don't test against a distro-patched kernel, but against vanilla kernel.
Since the patch will appear after 2.6.29, you should test using 2.6.29.

Cheers,
Mauro
--
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
David Wong March 27, 2009, 1:08 p.m. UTC | #2
On Fri, Mar 27, 2009 at 6:07 PM, Mauro Carvalho Chehab
<mchehab@infradead.org> wrote:
> On Wed, 18 Mar 2009 00:00:10 +0800
> David Wong <davidtlwong@gmail.com> wrote:
>
>> CXUSB D680 DMB pipe draining code found to be problematic for new
>> kernels (eg. kernel 2.6.27 @ Ubuntu 8.10)
>
> Could you please provide a clearer description? Why is it problematic? Also,
> please don't test against a distro-patched kernel, but against vanilla kernel.
> Since the patch will appear after 2.6.29, you should test using 2.6.29.
>
> Cheers,
> Mauro
>

With that pipe draining code, the USB controller response is weird,
i2c doesn't work.
But Timothy Lee said he need that to drain the pipe after hibernate.
Seems some TS data remains in the pipe
that troubles mplayer.

Regards,
David
--
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

diff -r 626c136ec221 linux/drivers/media/dvb/dvb-usb/cxusb.c
--- a/linux/drivers/media/dvb/dvb-usb/cxusb.c	Fri Mar 13 14:35:14 2009 -0700
+++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c	Tue Mar 17 23:20:00 2009 +0800
@@ -322,58 +322,11 @@ 
 	return 0;
 }
 
-static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
-{
-	int       ep = d->props.generic_bulk_ctrl_endpoint;
-	const int timeout = 100;
-	const int junk_len = 32;
-	u8        *junk;
-	int       rd_count;
-
-	/* Discard remaining data in video pipe */
-	junk = kmalloc(junk_len, GFP_KERNEL);
-	if (!junk)
-		return;
-	while (1) {
-		if (usb_bulk_msg(d->udev,
-			usb_rcvbulkpipe(d->udev, ep),
-			junk, junk_len, &rd_count, timeout) < 0)
-			break;
-		if (!rd_count)
-			break;
-	}
-	kfree(junk);
-}
-
-static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
-{
-	struct usb_data_stream_properties *p = &d->props.adapter[0].stream;
-	const int timeout = 100;
-	const int junk_len = p->u.bulk.buffersize;
-	u8        *junk;
-	int       rd_count;
-
-	/* Discard remaining data in video pipe */
-	junk = kmalloc(junk_len, GFP_KERNEL);
-	if (!junk)
-		return;
-	while (1) {
-		if (usb_bulk_msg(d->udev,
-			usb_rcvbulkpipe(d->udev, p->endpoint),
-			junk, junk_len, &rd_count, timeout) < 0)
-			break;
-		if (!rd_count)
-			break;
-	}
-	kfree(junk);
-}
-
 static int cxusb_d680_dmb_streaming_ctrl(
 		struct dvb_usb_adapter *adap, int onoff)
 {
 	if (onoff) {
 		u8 buf[2] = { 0x03, 0x00 };
-		cxusb_d680_dmb_drain_video(adap->dev);
 		return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
 			buf, sizeof(buf), NULL, 0);
 	} else {
@@ -1118,13 +1081,6 @@ 
 	usb_clear_halt(d->udev,
 		usb_rcvbulkpipe(d->udev, d->props.adapter[0].stream.endpoint));
 
-	/* Drain USB pipes to avoid hang after reboot */
-	for (n = 0;  n < 5;  n++) {
-		cxusb_d680_dmb_drain_message(d);
-		cxusb_d680_dmb_drain_video(d);
-		msleep(200);
-	}
-
 	/* Reset the tuner */
 	if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
 		err("clear tuner gpio failed");