From patchwork Thu Aug 4 07:14:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 1034112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p747EoAC032168 for ; Thu, 4 Aug 2011 07:14:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171Ab1HDHOr (ORCPT ); Thu, 4 Aug 2011 03:14:47 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52529 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050Ab1HDHO3 (ORCPT ); Thu, 4 Aug 2011 03:14:29 -0400 Received: from localhost (p548E06E4.dip0.t-ipconnect.de [84.142.6.228]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LwZNH-1RRDY31TZP-018IQi; Thu, 04 Aug 2011 09:14:28 +0200 From: Thierry Reding To: linux-media@vger.kernel.org Subject: [PATCH 16/21] [staging] tm6000: Select interface on first open. Date: Thu, 4 Aug 2011 09:14:14 +0200 Message-Id: <1312442059-23935-17-git-send-email-thierry.reding@avionic-design.de> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1312442059-23935-1-git-send-email-thierry.reding@avionic-design.de> References: <1312442059-23935-1-git-send-email-thierry.reding@avionic-design.de> X-Provags-ID: V02:K0:Dzv1KSk8B+TUFf+5rCPEFGejyhcPkSDRU6slE22EoKv 0EYBrOIO9y7JfOKc9Q9uvSerMVx6Qdtyn2AEgG7NmgkPDrHa72 8B64Qq1gywX4JaAaIbDLwCbMbDpPxKKflgjJ8Sd4xwp+IlMrz8 R4cOFiZ5oqGdXqFuPG/UUE9SzSdjFNtW2T0MceT4p7UqcCVMm9 b6FR4hPSSxZ66uX4qraE+XBKc/RoWZaYG0NE9mSydN6AM0E003 mx6K3fEKgL0+Z 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.6 (demeter1.kernel.org [140.211.167.41]); Thu, 04 Aug 2011 07:14:50 +0000 (UTC) Instead of selecting the default interface setting when preparing isochronous transfers, select it on the first call to open() to make sure it is available earlier. --- drivers/staging/tm6000/tm6000-video.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 70fc19e..b59a0da 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -595,11 +595,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev) tm6000_uninit_isoc(dev); /* Stop interrupt USB pipe */ tm6000_ir_int_stop(dev); - - usb_set_interface(dev->udev, - dev->isoc_in.bInterfaceNumber, - dev->isoc_in.bAlternateSetting); - /* Start interrupt USB pipe */ tm6000_ir_int_start(dev); @@ -1484,6 +1479,18 @@ static int tm6000_open(struct file *file) break; } + if (dev->users == 0) { + int err = usb_set_interface(dev->udev, + dev->isoc_in.bInterfaceNumber, + dev->isoc_in.bAlternateSetting); + if (err < 0) { + dev_err(&vdev->dev, "failed to select interface %d, " + "alt. setting %d\n", + dev->isoc_in.bInterfaceNumber, + dev->isoc_in.bAlternateSetting); + } + } + /* If more than one user, mutex should be added */ dev->users++;