summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/usb_gadget_common.c57
1 files changed, 6 insertions, 51 deletions
diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c
index fb6a986..a061084 100644
--- a/hw/usb_gadget_common.c
+++ b/hw/usb_gadget_common.c
@@ -211,14 +211,13 @@ static inline struct usb_function *find_func(struct usb_gadget *gadget,
static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
struct usb_gadget **_gadget)
{
- struct usb_gadget *gadget;
- int n_configs = 0;
- /* zero terminates */
- int functions[2][sizeof(gadget_id->function_mask)*8];
+ int ret;
+ int idx, i, j;
int n_functions;
+ int n_configs = 0;
+ struct usb_gadget *gadget;
struct usb_function **funcs;
- int idx, i, j;
- int ret;
+ int functions[2][sizeof(gadget_id->function_mask)*8]; /* zero terminates */
if (!gadget_id || !_gadget)
return -EINVAL;
@@ -235,27 +234,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
* so in this switch we sort our functions in a correct order
*/
switch (gadget_id->function_mask) {
- case USB_FUNCTION_MTP:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_MTP;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_ACM:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_ACM;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_SDB;
- functions[0][1] = 0;
- gadget->attrs.idProduct = 0x685d;
- break;
-
/* MTP, ACM, SDB */
case USB_FUNCTION_MTP | USB_FUNCTION_ACM:
n_configs = 1;
@@ -265,22 +243,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
gadget->attrs.idProduct = 0x6860;
break;
- case USB_FUNCTION_ACM | USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_ACM;
- functions[0][1] = USB_FUNCTION_SDB;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
- case USB_FUNCTION_MTP | USB_FUNCTION_SDB:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_MTP;
- functions[0][1] = USB_FUNCTION_SDB;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6860;
- break;
-
case USB_FUNCTION_MTP | USB_FUNCTION_ACM | USB_FUNCTION_SDB:
n_configs = 1;
functions[0][0] = USB_FUNCTION_MTP;
@@ -309,14 +271,6 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
gadget->attrs.idProduct = 0x6863;
break;
- case USB_FUNCTION_SDB | USB_FUNCTION_RNDIS:
- n_configs = 1;
- functions[0][0] = USB_FUNCTION_SDB;
- functions[0][1] = USB_FUNCTION_RNDIS;
- functions[0][2] = 0;
- gadget->attrs.idProduct = 0x6864;
- break;
-
case USB_FUNCTION_RNDIS | USB_FUNCTION_DIAG:
n_configs = 1;
functions[0][0] = USB_FUNCTION_RNDIS;
@@ -405,6 +359,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
*_gadget = gadget;
return 0;
+
free_configs:
free_functions:
free_gadget: