From patchwork Mon May 3 16:24:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarah Sharp X-Patchwork-Id: 96514 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o43GPOoI009804 for ; Mon, 3 May 2010 16:25:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933211Ab0ECQY6 (ORCPT ); Mon, 3 May 2010 12:24:58 -0400 Received: from mga01.intel.com ([192.55.52.88]:39020 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933204Ab0ECQY5 (ORCPT ); Mon, 3 May 2010 12:24:57 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 03 May 2010 09:22:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.52,320,1270450800"; d="scan'208";a="794985365" Received: from unknown (HELO xanatos) ([134.134.16.96]) by fmsmga001.fm.intel.com with ESMTP; 03 May 2010 09:24:45 -0700 Date: Mon, 3 May 2010 09:24:55 -0700 From: Sarah Sharp To: Jean-Francois Moine Cc: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Hans de Goede , linux-kernel@vger.kernel.org, Andiry Xu Subject: [PATCH] gspca: Try a less bandwidth-intensive alt setting. Message-ID: <20100503162427.GA5132@xanatos> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 03 May 2010 16:25:25 +0000 (UTC) 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;