epautoconf has two global variables which count the endpoint number current endpoint assignet endpoint. This patch removes the global variable and keeps it as per (UDC) gadget.
Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de> --- drivers/usb/gadget/epautoconf.c | 23 ++++++----------------- include/linux/usb/gadget.h | 6 ++++++ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 51f3d42..2c6c61f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -22,17 +22,6 @@ #include "gadget_chips.h" - -/* we must assign addresses for configurable endpoints (like net2280) */ -static unsigned epnum; - -// #define MANY_ENDPOINTS -#ifdef MANY_ENDPOINTS -/* more than 15 configurable endpoints */ -static unsigned in_epnum; -#endif - - /* * This should work with endpoints from controller drivers sharing the * same endpoint naming convention. By example: @@ -178,14 +167,14 @@ ep_matches ( desc->bEndpointAddress |= num; #ifdef MANY_ENDPOINTS } else if (desc->bEndpointAddress & USB_DIR_IN) { - if (++in_epnum > 15) + if (++gadget->in_epnum > 15) return 0; - desc->bEndpointAddress = USB_DIR_IN | in_epnum; + desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum; #endif } else { - if (++epnum > 15) + if (++gadget->epnum > 15) return 0; - desc->bEndpointAddress |= epnum; + desc->bEndpointAddress |= gadget->epnum; } /* report (variable) full speed bulk maxpacket */ @@ -386,8 +375,8 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) ep->driver_data = NULL; } #ifdef MANY_ENDPOINTS - in_epnum = 0; + gadget->in_epnum = 0; #endif - epnum = 0; + gadget->epnum = 0; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index fdf85a7..01fe02a 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -537,6 +537,12 @@ struct usb_gadget { unsigned a_alt_hnp_support:1; const char *name; struct device dev; + unsigned epnum; +/* #define MANY_ENDPOINTS */ +#ifdef MANY_ENDPOINTS + /* more than 15 configurable endpoints */ + unsigned in_epnum; +#endif }; static inline void set_gadget_data(struct usb_gadget *gadget, void *data) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html