aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Goby <benoit@android.com>2012-01-20 14:42:41 -0800
committerPaul Kocialkowski <contact@paulk.fr>2014-05-02 20:52:56 +0200
commit15d7b5247d8a0d9575ac917313ae7b779ae1aa28 (patch)
treed969a46aba7ac3693d544c7df1e5fd0dc29e528d
parent49140eaa9cd69094f35e397141ba0b9bf4bc6da8 (diff)
downloadkernel_goldelico_gta04-15d7b5247d8a0d9575ac917313ae7b779ae1aa28.zip
kernel_goldelico_gta04-15d7b5247d8a0d9575ac917313ae7b779ae1aa28.tar.gz
kernel_goldelico_gta04-15d7b5247d8a0d9575ac917313ae7b779ae1aa28.tar.bz2
usb: gadget: Fix usb string id allocation
Don't reset next_string_id every time the gadget is enabled, this makes the next strings allocated overwrite strings allocated at probe time. Instead, fix rndis not to allocate new string ids on every config bind. Change-Id: Ied28ee416bb6f00c434c34176fe5b7f0dcb2b2d4 Signed-off-by: Benoit Goby <benoit@android.com>
-rw-r--r--drivers/usb/gadget/android.c1
-rw-r--r--drivers/usb/gadget/rndis.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index ff60af7..5a65149 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -1150,7 +1150,6 @@ static ssize_t enable_store(struct device *pdev, struct device_attribute *attr,
sscanf(buff, "%d", &enabled);
if (enabled && !dev->enabled) {
- cdev->next_string_id = 0;
/*
* Update values in composite driver's copy of
* device descriptor.
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 9575085..10da3441 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -1141,11 +1141,15 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS];
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
+static bool rndis_initialized;
static int rndis_init(void)
{
u8 i;
+ if (rndis_initialized)
+ return 0;
+
for (i = 0; i < RNDIS_MAX_CONFIGS; i++) {
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
char name [20];
@@ -1172,6 +1176,7 @@ static int rndis_init(void)
INIT_LIST_HEAD(&(rndis_per_dev_params[i].resp_queue));
}
+ rndis_initialized = true;
return 0;
}
module_init(rndis_init);
@@ -1182,6 +1187,13 @@ static void rndis_exit(void)
u8 i;
char name[20];
+#endif
+
+ if (!rndis_initialized)
+ return;
+ rndis_initialized = false;
+
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
for (i = 0; i < RNDIS_MAX_CONFIGS; i++) {
sprintf(name, NAME_TEMPLATE, i);
remove_proc_entry(name, NULL);