On Fri, 14 Jan 2011, Felipe Balbi wrote: > Hi, > > On Fri, Jan 14, 2011 at 04:14:12PM +0200, Felipe Balbi wrote: > > > Why not embed the gadget and the device node directly in the usb_udc > > > structure, instead of just putting pointers there? > > > > I'll do that now. Thanks. > > I had an idea of completely re-writting this. It really doesn't to be > this complicated. I was thinking of something more like: > > struct udc { > struct usb_gadget *gadget; > struct usb_gadget_driver *driver; > struct list_head list; > }; I have forgotten most of the original details, so bear with me. Why is this called "struct udc" when all its members refer to gadgets or gadget drivers instead of UDCs or UDC drivers? > then add a function like: > > int usb_add_gadget(struct device *parent, struct usb_gadget *gadget, > struct usb_gadget_ops *ops) > { > struct usb_udc *udc; > > udc = kzalloc(sizeof(*udc), GFP_KERNEL); > if (!udc) > return -ENOMEM; > > > gadget->dev.parent = parent; > gadget->ops = ops; > > udc->gadget = gadget; > INIT_LIST_HEAD(&udc->list); > > list_add_tail(&udc->list, &udc_list); > > return device_register(&gadget->dev); > } > > a lot simpler, it won't have too many changes needed on gadget > controllers and it will still allow to compile several of them together. > > Of course I'll do this on top of Michal's recent patch. You should also see about integrating it with Matthieu Castet's work to allow multiple UDC drivers in a single kernel image. Or maybe this is completely independent of that... I don't remember enough to know. 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