summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_subset.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/f_subset.c')
-rw-r--r--drivers/usb/gadget/f_subset.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c
index deb437c..856dbae 100644
--- a/drivers/usb/gadget/f_subset.c
+++ b/drivers/usb/gadget/f_subset.c
@@ -319,38 +319,22 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
geth->port.out_ep = ep;
ep->driver_data = cdev; /* claim */
- /* copy descriptors, and track endpoint copies */
- f->descriptors = usb_copy_descriptors(fs_eth_function);
- if (!f->descriptors)
- goto fail;
-
/* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
* both speeds
*/
- if (gadget_is_dualspeed(c->cdev->gadget)) {
- hs_subset_in_desc.bEndpointAddress =
- fs_subset_in_desc.bEndpointAddress;
- hs_subset_out_desc.bEndpointAddress =
- fs_subset_out_desc.bEndpointAddress;
-
- /* copy descriptors, and track endpoint copies */
- f->hs_descriptors = usb_copy_descriptors(hs_eth_function);
- if (!f->hs_descriptors)
- goto fail;
- }
+ hs_subset_in_desc.bEndpointAddress = fs_subset_in_desc.bEndpointAddress;
+ hs_subset_out_desc.bEndpointAddress =
+ fs_subset_out_desc.bEndpointAddress;
- if (gadget_is_superspeed(c->cdev->gadget)) {
- ss_subset_in_desc.bEndpointAddress =
- fs_subset_in_desc.bEndpointAddress;
- ss_subset_out_desc.bEndpointAddress =
- fs_subset_out_desc.bEndpointAddress;
+ ss_subset_in_desc.bEndpointAddress = fs_subset_in_desc.bEndpointAddress;
+ ss_subset_out_desc.bEndpointAddress =
+ fs_subset_out_desc.bEndpointAddress;
- /* copy descriptors, and track endpoint copies */
- f->ss_descriptors = usb_copy_descriptors(ss_eth_function);
- if (!f->ss_descriptors)
- goto fail;
- }
+ status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function,
+ ss_eth_function);
+ if (status)
+ goto fail;
/* NOTE: all that is done without knowing or caring about
* the network link ... which is unavailable to this code
@@ -364,11 +348,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
return 0;
fail:
- if (f->descriptors)
- usb_free_descriptors(f->descriptors);
- if (f->hs_descriptors)
- usb_free_descriptors(f->hs_descriptors);
-
+ usb_free_all_descriptors(f);
/* we might as well release our claims on endpoints */
if (geth->port.out_ep)
geth->port.out_ep->driver_data = NULL;
@@ -383,11 +363,7 @@ fail:
static void
geth_unbind(struct usb_configuration *c, struct usb_function *f)
{
- if (gadget_is_superspeed(c->cdev->gadget))
- usb_free_descriptors(f->ss_descriptors);
- if (gadget_is_dualspeed(c->cdev->gadget))
- usb_free_descriptors(f->hs_descriptors);
- usb_free_descriptors(f->descriptors);
+ usb_free_all_descriptors(f);
geth_string_defs[1].s = NULL;
kfree(func_to_geth(f));
}