[PATCH 10/37] usb: gadget: bcm63xx_udc: add ep capabilities support

From: Robert Baldyga
Date: Wed Jul 08 2015 - 07:24:16 EST


Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@xxxxxxxxxxx>
---
drivers/usb/gadget/udc/bcm63xx_udc.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
index 9db968b..c5e0894 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -44,9 +44,25 @@
#define DRV_MODULE_NAME "bcm63xx_udc"

static const char bcm63xx_ep0name[] = "ep0";
-static const char *const bcm63xx_ep_name[] = {
- bcm63xx_ep0name,
- "ep1in-bulk", "ep2out-bulk", "ep3in-int", "ep4out-int",
+
+static const struct {
+ const char *name;
+ const struct usb_ep_caps caps;
+} bcm63xx_ep_info[] = {
+#define EP_INFO(_name, _type, _dir) \
+ { \
+ .name = _name, \
+ .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+ USB_EP_CAPS_DIR_ ## _dir), \
+ }
+
+ EP_INFO(bcm63xx_ep0name, CONTROL, ALL),
+ EP_INFO("ep1in-bulk", BULK, IN),
+ EP_INFO("ep2out-bulk", BULK, OUT),
+ EP_INFO("ep3in-int", INT, IN),
+ EP_INFO("ep4out-int", INT, OUT),
+
+#undef EP_INFO
};

static bool use_fullspeed;
@@ -943,7 +959,8 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc)
for (i = 0; i < BCM63XX_NUM_EP; i++) {
struct bcm63xx_ep *bep = &udc->bep[i];

- bep->ep.name = bcm63xx_ep_name[i];
+ bep->ep.name = bcm63xx_ep_info[i].name;
+ bep->ep.caps = bcm63xx_ep_info[i].caps;
bep->ep_num = i;
bep->ep.ops = &bcm63xx_udc_ep_ops;
list_add_tail(&bep->ep.ep_list, &udc->gadget.ep_list);
--
1.9.1

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