On Sat, 15 May 2010, Ming Lei wrote: > 2010/5/15 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>: > > On Fri, 14 May 2010 tom.leiming@xxxxxxxxx wrote: > > > >> From: Ming Lei <tom.leiming@xxxxxxxxx> > >> > > > Instead of changing what the code does in the normal case, why not just > > prevent it from being used with root hubs? Add an initial test: > > > > /* Removing root hubs makes no sense */ > > if (!udev->parent) > > return -EINVAL; > > > > usb_lock_device(udev) ... > > > > Yes, it is really doable. My question is that why usb_set_configuration(-1) > may avoid races according to the comment, and what is the races ? To tell the truth, I don't remember! All I can recall is that usb_set_configuration is a "softer" way of unbinding drivers than usb_remove_device, because the unbind takes place while the port is still enabled and so the driver has a chance to send any final commands (such as SYNCHRONIZE CACHE) to the device. 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