This is a sincere question, and not an attempt at being snide, but from a userspace perspective, should the frequency of claiming/releasing an interface really matter? There's nothing in the libusb documentation advising against it, and the docs also state it must be used before performing I/O: *You must claim the interface you wish to use before you can perform I/O on any of its endpoints. *Claiming of interfaces is a purely logical operation; it does not cause any requests to be sent over the bus. Interface claiming is used to instruct the underlying operating system that your application wishes to take ownership of the interface. I realize it's not ideal to have to claim/release so rapidly, but it's not invoking undefined behavior. ============================================================ Matthew Giassa, MASc, BASc, EIT Security and Embedded Systems Specialist linkedin: https://ca.linkedin.com/in/giassa e-mail: matthew@xxxxxxxxxx website: www.giassa.net > -------- Original Message -------- > Subject: RE: [PATCH 1/1] usb: lpm: add boot flag to disable lpm > From: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > Date: Thu, April 14, 2016 8:56 am > To: Matthew Giassa <matthew@xxxxxxxxxx> > Cc: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>, Greg KH > <gregkh@xxxxxxxxxxxxxxxxxxx>, <linux-usb@xxxxxxxxxxxxxxx> > > > On Thu, 14 Apr 2016, Matthew Giassa wrote: > > > I should also note that these "control" r/w calls are made very > > frequently. A thread is spawned for each camera that periodically polls > > for things like exposure levels, average brightness, etc, to update a > > metrics cache and UI display for said metrics. > > That sounds like a disastrous recipe. > > Instead of using a mutex, you should consider creating a dedicated > thread for each camera to handle the control interface. Anybody else > that wants to use the control interface should ask the dedicated thread > to carry out the I/O on their behalf. That way your program wouldn't > constantly be claiming and releasing interfaces. > > Alan Stern > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html