On Thu, 2012-03-15 at 19:42 +0800, Ming Lei wrote: > Hi, > > On Thu, Mar 15, 2012 at 7:31 PM, Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote: > > >> So how about using lockdep_set_class to address the problem? > > > > Can do, you say the USB spec allows for 32 interfaces, what happens if a > > device manufacturer 'mis-reads' the spec and puts 64 on? Will that > > simply not work or will we get 'fun' results? > > USB spec only says that "Each configuration has one or more interfaces > and each interface has zero or more endpoints. "[1] In fact, maybe 255 > interfaces can be described in configuration desc. I mean that current > USB protocol stack(usbcore) only supports 32 interfaces in one > configuration, see below: > > #define USB_MAXINTERFACES 32 > struct usb_host_config { > ...... > struct usb_interface *interface[USB_MAXINTERFACES]; > ...... > } OK, so I guess our USB stack will fall over before lockdep does. Sure add something like: struct lock_class_key usb_interface_key[USB_MAXINTERFACES]; and add something like: mutex_init(&us->dev_mutex); + lockdep_set_class(&us->dev_mutex, &usb_interface_key[if]); -- 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