From patchwork Tue Mar 17 16:00:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wong X-Patchwork-Id: 12636 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2HG0cKM026270 for ; Tue, 17 Mar 2009 16:00:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839AbZCQQAN (ORCPT ); Tue, 17 Mar 2009 12:00:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753768AbZCQQAN (ORCPT ); Tue, 17 Mar 2009 12:00:13 -0400 Received: from rv-out-0506.google.com ([209.85.198.234]:2893 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753839AbZCQQAM (ORCPT ); Tue, 17 Mar 2009 12:00:12 -0400 Received: by rv-out-0506.google.com with SMTP id g37so62373rvb.1 for ; Tue, 17 Mar 2009 09:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=s9yXbknhuTOPlXod1FocK5XsUqQN4HII2wOtrL4+cEg=; b=cAU5VGJT285xZn6IIwNA08kf7lVGqd38gC/sPBTJ26eM2+vcPkGKX/XKydVG4Fu6+H PmoFegKrf7kT/jZslHWaUDpyeYeN5owmjxfjEYa4pki+8Nqpwey+vQEaMG9BupxsEmIt aD3mCk01d0LpCOmDx7h6HegIDmvSMrTm/qOgM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=v4h+HkZ3YUPJZDafRFMY7oMROSfO7hadoOGz6EgqSZ8x4//WkPiR+8b0ekp3wa9Z2c +7201HCGjJ2clPPmD6mb1euj4Z3BdGjxAk+pgPfts2WI4NrlaI2RaoDIo24KttXtlrmO ab2FL6upbE1RaAHs75sn4ANeZWnHjFjDiNaVw= MIME-Version: 1.0 Received: by 10.141.211.5 with SMTP id n5mr30733rvq.279.1237305610119; Tue, 17 Mar 2009 09:00:10 -0700 (PDT) Date: Wed, 18 Mar 2009 00:00:10 +0800 Message-ID: <15ed362e0903170900y6a71cb71oc65768367a8cfd14@mail.gmail.com> Subject: [PATCH] Remove stream pipe draining code for CXUSB D680 DMB From: David Wong To: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 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");