How about the following: Below, I show how the initialization of the
current controller is done (statically). Removing this struct
initialization completely would make the code much uglier, introducing
many individual assignments.
static struct lpc32xx_udc controller = {
.gadget = {
.ops =&lpc32xx_udc_ops,
.ep0 =&controller.ep[0].ep,
.name = driver_name,
.dev = {
.init_name = "gadget",
.release = nop_release,
}
},
.ep[0] = {
.ep = {
.name = "ep0",
.ops =&lpc32xx_ep_ops,
},
.udc =&controller,
.maxpacket = 64,
.hwep_num_base = 0,
.hwep_num = 0, /* Can be 0 or 1, has special
handling */
.lep = 0,
.eptype = EP_CTL_TYPE,
},
.ep[1] = {
.ep = {
.name = "ep1-int",
.ops =&lpc32xx_ep_ops,
},
.udc =&controller,
.maxpacket = 64,
.hwep_num_base = 2,
.hwep_num = 0, /* 2 or 3, will be set later */
.lep = 1,
.eptype = EP_INT_TYPE,