Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325910
b: refs/heads/master
c: e87bb71
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Felipe Balbi committed Sep 10, 2012
1 parent 135fd1c commit 25df726
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0ba16dea72a457bf65fc06ef60165c994e2f7420
refs/heads/master: e87bb7118c4f752de4616a7ab56c51ed3e7f6f53
27 changes: 6 additions & 21 deletions trunk/drivers/usb/gadget/epautoconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -176,16 +165,14 @@ ep_matches (
if (isdigit (ep->name [2])) {
u8 num = simple_strtoul (&ep->name [2], NULL, 10);
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;
#endif
desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum;
} else {
if (++epnum > 15)
if (++gadget->out_epnum > 15)
return 0;
desc->bEndpointAddress |= epnum;
desc->bEndpointAddress |= gadget->out_epnum;
}

/* report (variable) full speed bulk maxpacket */
Expand Down Expand Up @@ -385,9 +372,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
list_for_each_entry (ep, &gadget->ep_list, ep_list) {
ep->driver_data = NULL;
}
#ifdef MANY_ENDPOINTS
in_epnum = 0;
#endif
epnum = 0;
gadget->in_epnum = 0;
gadget->out_epnum = 0;
}

4 changes: 4 additions & 0 deletions trunk/include/linux/usb/gadget.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ struct usb_gadget_ops {
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
* @out_epnum: last used out ep number
* @in_epnum: last used in ep number
*
* Gadgets have a mostly-portable "gadget driver" implementing device
* functions, handling all usb configurations and interfaces. Gadget
Expand Down Expand Up @@ -537,6 +539,8 @@ struct usb_gadget {
unsigned a_alt_hnp_support:1;
const char *name;
struct device dev;
unsigned out_epnum;
unsigned in_epnum;
};

static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
Expand Down

0 comments on commit 25df726

Please sign in to comment.