aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/epautoconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/epautoconf.c')
-rw-r--r--drivers/usb/gadget/epautoconf.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 51f3d42f5a64..a777f7bd11b4 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <linux/device.h> 16#include <linux/device.h>
@@ -22,17 +23,6 @@
22 23
23#include "gadget_chips.h" 24#include "gadget_chips.h"
24 25
25
26/* we must assign addresses for configurable endpoints (like net2280) */
27static unsigned epnum;
28
29// #define MANY_ENDPOINTS
30#ifdef MANY_ENDPOINTS
31/* more than 15 configurable endpoints */
32static unsigned in_epnum;
33#endif
34
35
36/* 26/*
37 * This should work with endpoints from controller drivers sharing the 27 * This should work with endpoints from controller drivers sharing the
38 * same endpoint naming convention. By example: 28 * same endpoint naming convention. By example:
@@ -176,16 +166,14 @@ ep_matches (
176 if (isdigit (ep->name [2])) { 166 if (isdigit (ep->name [2])) {
177 u8 num = simple_strtoul (&ep->name [2], NULL, 10); 167 u8 num = simple_strtoul (&ep->name [2], NULL, 10);
178 desc->bEndpointAddress |= num; 168 desc->bEndpointAddress |= num;
179#ifdef MANY_ENDPOINTS
180 } else if (desc->bEndpointAddress & USB_DIR_IN) { 169 } else if (desc->bEndpointAddress & USB_DIR_IN) {
181 if (++in_epnum > 15) 170 if (++gadget->in_epnum > 15)
182 return 0; 171 return 0;
183 desc->bEndpointAddress = USB_DIR_IN | in_epnum; 172 desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum;
184#endif
185 } else { 173 } else {
186 if (++epnum > 15) 174 if (++gadget->out_epnum > 15)
187 return 0; 175 return 0;
188 desc->bEndpointAddress |= epnum; 176 desc->bEndpointAddress |= gadget->out_epnum;
189 } 177 }
190 178
191 /* report (variable) full speed bulk maxpacket */ 179 /* report (variable) full speed bulk maxpacket */
@@ -328,6 +316,7 @@ found_ep:
328 ep->comp_desc = NULL; 316 ep->comp_desc = NULL;
329 return ep; 317 return ep;
330} 318}
319EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
331 320
332/** 321/**
333 * usb_ep_autoconfig() - choose an endpoint matching the 322 * usb_ep_autoconfig() - choose an endpoint matching the
@@ -367,7 +356,7 @@ struct usb_ep *usb_ep_autoconfig(
367{ 356{
368 return usb_ep_autoconfig_ss(gadget, desc, NULL); 357 return usb_ep_autoconfig_ss(gadget, desc, NULL);
369} 358}
370 359EXPORT_SYMBOL_GPL(usb_ep_autoconfig);
371 360
372/** 361/**
373 * usb_ep_autoconfig_reset - reset endpoint autoconfig state 362 * usb_ep_autoconfig_reset - reset endpoint autoconfig state
@@ -385,9 +374,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
385 list_for_each_entry (ep, &gadget->ep_list, ep_list) { 374 list_for_each_entry (ep, &gadget->ep_list, ep_list) {
386 ep->driver_data = NULL; 375 ep->driver_data = NULL;
387 } 376 }
388#ifdef MANY_ENDPOINTS 377 gadget->in_epnum = 0;
389 in_epnum = 0; 378 gadget->out_epnum = 0;
390#endif
391 epnum = 0;
392} 379}
393 380EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);