summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-05-10 23:04:00 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-10 23:04:00 -0700
commit8e831a70d3cfcec2a990e6a5d9a2ea61fc47876a (patch)
tree1f57008870ca158e62338cecca09c13b3fef6477
parent05eae98b38ea52544a4b2541fdb10cbcb5214503 (diff)
parentc5f8a96b24589078e0b0c82983889029c846e18b (diff)
Merge "usb: gadget: f_mtp: Handle OS descriptors properly"
-rw-r--r--drivers/usb/gadget/function/f_mtp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c
index 7bfeb93f012c..6ee21d039415 100644
--- a/drivers/usb/gadget/function/f_mtp.c
+++ b/drivers/usb/gadget/function/f_mtp.c
@@ -1490,6 +1490,7 @@ mtp_function_bind(struct usb_configuration *c, struct usb_function *f)
mtp_fullspeed_out_desc.bEndpointAddress;
}
+ fi_mtp->func_inst.f = &dev->function;
DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
gadget_is_superspeed(c->cdev->gadget) ? "super" :
(gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full"),
@@ -1501,9 +1502,10 @@ static void
mtp_function_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct mtp_dev *dev = func_to_mtp(f);
+ struct mtp_instance *fi_mtp;
struct usb_request *req;
int i;
-
+ fi_mtp = container_of(f->fi, struct mtp_instance, func_inst);
mtp_string_defs[INTERFACE_STRING_INDEX].id = 0;
mutex_lock(&dev->read_mutex);
while ((req = mtp_req_get(dev, &dev->tx_idle)))
@@ -1517,6 +1519,7 @@ mtp_function_unbind(struct usb_configuration *c, struct usb_function *f)
dev->is_ptp = false;
kfree(f->os_desc_table);
f->os_desc_n = 0;
+ fi_mtp->func_inst.f = NULL;
}
static int mtp_function_set_alt(struct usb_function *f,
@@ -1916,7 +1919,6 @@ struct usb_function *function_alloc_mtp_ptp(struct usb_function_instance *fi,
dev->function.setup = mtp_ctrlreq_configfs;
dev->function.free_func = mtp_free;
dev->is_ptp = !mtp_config;
- fi->f = &dev->function;
return &dev->function;
}