usb: gadget: Reset string ids upon unbind

String ids for qdss,cdev and gsi based interfaces
are re-used even though the device re-enumerates.
This is causing string id sequence mismatch and resulting
in adb using the string id of qdss interface. Reset the
string ids for these functions in their respective unbind
calls to fix this issue.

Change-Id: Ia9b196734a99ccc2e8c35073ec4e535755774c16
Signed-off-by: Elson Roy Serrao <eserrao@codeaurora.org>
This commit is contained in:
Elson Roy Serrao 2019-10-15 13:52:45 -07:00 • committed by Jack Pham
commit 2a4a30b6a6
2 changed files with 10 additions and 0 deletions

View file

@ -867,6 +867,9 @@ static void usb_cser_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct f_cdev *port = func_to_port(f);
/* Reset string id */
cser_string_defs[0].id = 0;
usb_free_all_descriptors(f);
usb_cser_free_req(port->port_usb.notify, port->port_usb.notify_req);
}

View file

@ -3094,6 +3094,13 @@ static void gsi_unbind(struct usb_configuration *c, struct usb_function *f)
ipa_usb_deinit_teth_prot(gsi->prot_id);
/* Reset string ids */
rndis_gsi_string_defs[0].id = 0;
ecm_gsi_string_defs[0].id = 0;
rmnet_gsi_string_defs[0].id = 0;
mbim_gsi_string_defs[0].id = 0;
qdss_gsi_string_defs[0].id = 0;
if (gsi->prot_id == IPA_USB_RNDIS) {
gsi->d_port.sm_state = STATE_UNINITIALIZED;
rndis_deregister(gsi->params);