public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sarah Sharp <sarah.a.sharp@intel.com>
To: Jean-Francois Moine <moinejf@free.fr>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Hans de Goede <hdegoede@redhat.com>,
	linux-kernel@vger.kernel.org, Andiry Xu <andiry.xu@amd.com>
Subject: [PATCH] gspca: Try a less bandwidth-intensive alt setting.
Date: Mon, 3 May 2010 09:24:55 -0700	[thread overview]
Message-ID: <20100503162427.GA5132@xanatos> (raw)

Under OHCI, UHCI, and EHCI, if an alternate interface setting took too
much of the bus bandwidth, then submit_urb() would fail.  The xHCI host
controller does bandwidth checking when the alternate interface setting is
installed, so usb_set_interface() can fail.  If it does, try the next
alternate interface setting.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by:  Andiry Xu <andiry.xu@amd.com>
---
 drivers/media/video/gspca/gspca.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 222af47..6de3117 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -643,6 +643,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
 	xfer = gspca_dev->cam.bulk ? USB_ENDPOINT_XFER_BULK
 				   : USB_ENDPOINT_XFER_ISOC;
 	i = gspca_dev->alt;			/* previous alt setting */
+find_alt:
 	if (gspca_dev->cam.reverse_alts) {
 		while (++i < gspca_dev->nbalt) {
 			ep = alt_xfer(&intf->altsetting[i], xfer);
@@ -666,10 +667,11 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
 	if (gspca_dev->nbalt > 1) {
 		gspca_input_destroy_urb(gspca_dev);
 		ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, i);
-		if (ret < 0) {
-			err("set alt %d err %d", i, ret);
-			ep = NULL;
-		}
+		/* xHCI hosts will reject set interface requests
+		 * if they take too much bandwidth, so try again.
+		 */
+		if (ret < 0)
+			goto find_alt;
 		gspca_input_create_urb(gspca_dev);
 	}
 	return ep;
-- 
1.6.3.3


                 reply	other threads:[~2010-05-03 16:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100503162427.GA5132@xanatos \
    --to=sarah.a.sharp@intel.com \
    --cc=andiry.xu@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=moinejf@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox