Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278735 > unrolled thread

[PATCH v2 18/29] usb: gadget: configfs: add new composite API support

Started byRobert Baldyga <r.baldyga@samsung.com>
First post2015-11-27 12:10 +0100
Last post2015-11-27 12:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 18/29] usb: gadget: configfs: add new composite API support Robert Baldyga <r.baldyga@samsung.com> - 2015-11-27 12:10 +0100

#1278735 — [PATCH v2 18/29] usb: gadget: configfs: add new composite API support

FromRobert Baldyga <r.baldyga@samsung.com>
Date2015-11-27 12:10 +0100
Subject[PATCH v2 18/29] usb: gadget: configfs: add new composite API support
Message-ID<qzp4D-243-55@gated-at.bofh.it>
Handle functions using new API properly.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/usb/gadget/configfs.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 0557f80..153adf7 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1355,6 +1355,11 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
 				goto err_purge_funcs;
 			}
 		}
+
+		ret = usb_config_do_bind(c);
+		if (ret)
+			goto err_purge_funcs;
+
 		usb_ep_autoconfig_reset(cdev->gadget);
 	}
 	if (cdev->use_os_string) {
@@ -1363,10 +1368,23 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
 			goto err_purge_funcs;
 	}
 
+	ret = composite_prep_vendor_descs(cdev);
+	if (ret < 0)
+		goto err_free_vendor_descs;
+
+	ret = composite_generate_old_descs(cdev);
+	if (ret < 0)
+		goto err_free_old_descs;
+
 	usb_ep_autoconfig_reset(cdev->gadget);
 	return 0;
 
+err_free_old_descs:
+	composite_free_old_descs(cdev);
+err_free_vendor_descs:
+	composite_free_vendor_descs(cdev);
 err_purge_funcs:
+	composite_free_descs(cdev);
 	purge_configs_funcs(gi);
 err_comp_cleanup:
 	composite_dev_cleanup(cdev);
@@ -1383,6 +1401,10 @@ static void configfs_composite_unbind(struct usb_gadget *gadget)
 	cdev = get_gadget_data(gadget);
 	gi = container_of(cdev, struct gadget_info, cdev);
 
+	composite_free_old_descs(cdev);
+	composite_free_vendor_descs(cdev);
+	composite_free_descs(cdev);
+
 	kfree(otg_desc[0]);
 	otg_desc[0] = NULL;
 	purge_configs_funcs(gi);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web