Hi, Peter Chen writes: >> I suppose we could do something similar for the composite driver, for >> gadgets that don't use configfs. > > Originally, I intended to do at composite.c to cover all gadget drivers, but > I can't find a good way to use usb_composite_dev existing spinlock to do that. > Since most of users already used configfs, I chose to fix it at configfs directly. > If we want to fix it for legacy gadget drivers (drivers at drivers/usb/gadget/legacy/). > > For .setup & .suspend, we could delay 10ms after usb_gadget_disconnect, ensure > hardware has triggered related interrupt, and we need to let all UDC drivers to > add udc->gadget->irq, in that case, the pending threaded interrupt will be handled > at synchronize_irq at usb_gadget_remove_driver. > For .disconnect, we could use cdev->config to judge if the first .disconnect > has run. > >> But what about legacy gadgets? Are >> there any still around that don't use either configfs or the composite >> framework? > > I only find raw_gadget.c that doesn't use composite framework, and it doesn't implement > many usb_gadget_driver callbacks, eg, .disconnect and .suspend. For .setup, we could > use above solutions for legacy composite driver. IIRC the old EHCI debug gadget also fits the bill here. -- balbi