[PATCH 16/21] [staging] tm6000: Select interface on first open.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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++;
 
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux