On Thu, 5 Mar 2015, Peter Chen wrote: > Instead of iterate to find usb_udc according to usb_gadget, this > way is easier. > > Alan Stern suggests this way too: > http://marc.info/?l=linux-usb&m=142168496528894&w=2 > > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> Pretty much okay, but ... > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -475,6 +475,24 @@ struct usb_dcd_config_params { > struct usb_gadget; > struct usb_gadget_driver; > > +/** > + * struct usb_udc - describes one usb device controller > + * @driver - the gadget driver pointer. For use by the class code > + * @dev - the child device to the actual controller > + * @gadget - the gadget. For use by the class code > + * @list - for use by the udc class driver > + * > + * This represents the internal data structure which is used by the UDC-class > + * to hold information about udc driver and gadget together. > + */ > +struct usb_udc { > + struct usb_gadget_driver *driver; > + struct usb_gadget *gadget; > + struct device dev; > + struct list_head list; > +}; You don't need to move this definition into gadget.h. It can stay where it is now. This file only needs: struct usb_udc; After that has been fixed: Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> 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