On Wed, 18 May 2011, Alexey ORISHKO wrote: > > From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx] > > Sent: Wednesday, May 18, 2011 4:55 PM > > > > Here and later on, the patch seems to have forgotten about the control > > interface. Is this deliberate or an oversight? > > > > Alan Stern > > Kernel docs says, that usb_driver_claim_interface() is used by usb > device drivers that need to claim more than one interface. I assume, > it's needed for second interface only. Am I wrong? Well, if a driver wants to claim three interfaces (which is more than one), it would call usb_driver_claim_interface() for both the second and third interfaces, not only the second. In general, when the driver gets probed for any one of the interfaces, it should identify all the interfaces it's interested in and claim them. However, it should skip the interface currently being probed -- that usb_driver_claim_interface() call would fail anyway since an interface can't be claimed while it is being probed. Similarly, when any of the interfaces is unbound, the driver should release them all. > NCM driver was partly based on ECM code. I did check existing drivers > for CDC ACM and CDC ECM, which also uses 2 interfaces: master (control) > and data (bulk), but I was unable to find any code, which claims master > interface. > > If we need explicitly claim/release master interface (which is *intf > parameter in bind() and unbind()), then cdc-acm and usb_ether drivers > should be updated as well. As far as I can tell, those drivers check that they are being probed for the control interface, so all they need to claim is the data interface. You could do something similar -- have the bind routine return -ENODEV if it's not being called for the control interface. But the unbind routine would still have to release both interfaces, since it can't rely on being called for the control interface first. 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