[PATCH 09/23] USB: gadget: DFU: Use usb_assign_descriptors/usb_free_all_descriptors
Sascha Hauer
s.hauer at pengutronix.de
Mon Jul 21 08:14:33 PDT 2014
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/usb/gadget/dfu.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index a685cc1..5252703 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -132,19 +132,13 @@ dfu_bind(struct usb_configuration *c, struct usb_function *f)
header[i] = (struct usb_descriptor_header *) &usb_dfu_func;
header[i + 1] = NULL;
- /* copy descriptors, and track endpoint copies */
- f->fs_descriptors = usb_copy_descriptors(header);
- if (!f->fs_descriptors)
- goto out;
+ status = usb_assign_descriptors(f, header, header, NULL);
- /* 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)) {
- /* copy descriptors, and track endpoint copies */
- f->hs_descriptors = usb_copy_descriptors(header);
- }
+ free(desc);
+ free(header);
+
+ if (status)
+ goto out;
for (i = 0; i < dfu_num_alt; i++)
printf("dfu: register alt%d(%s) with device %s\n",
@@ -164,9 +158,7 @@ dfu_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct f_dfu *dfu = func_to_dfu(f);
- free(f->fs_descriptors);
- if (gadget_is_dualspeed(c->cdev->gadget))
- free(f->hs_descriptors);
+ usb_free_all_descriptors(f);
dma_free(dfu->dnreq->buf);
usb_ep_free_request(c->cdev->gadget->ep0, dfu->dnreq);
--
2.0.1
More information about the barebox
mailing list