[PATCH v2 04/11] usb: udc: assign epnum for each usb endpoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When record trace event in UDC core layer, it will reduce trace ring
buffer usage if record one u32 variable including epnum, use
USB_EP_NAME() macro will generate endpoint name from epnum.

Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
---
v2: fix two compile issue,
one for udc-xilinx.c, Reported-by: kernel test robot <lkp@xxxxxxxxx>
the other for fsl_udc_core.c, found by me.

 drivers/usb/cdns3/cdns3-gadget.c            | 1 +
 drivers/usb/cdns3/cdnsp-gadget.c            | 1 +
 drivers/usb/chipidea/udc.c                  | 1 +
 drivers/usb/dwc2/gadget.c                   | 2 +-
 drivers/usb/dwc3/gadget.c                   | 1 +
 drivers/usb/fotg210/fotg210-udc.c           | 1 +
 drivers/usb/gadget/udc/aspeed-vhub/epn.c    | 1 +
 drivers/usb/gadget/udc/aspeed_udc.c         | 1 +
 drivers/usb/gadget/udc/at91_udc.c           | 1 +
 drivers/usb/gadget/udc/atmel_usba_udc.c     | 1 +
 drivers/usb/gadget/udc/bcm63xx_udc.c        | 1 +
 drivers/usb/gadget/udc/bdc/bdc_ep.c         | 1 +
 drivers/usb/gadget/udc/cdns2/cdns2-gadget.c | 2 +-
 drivers/usb/gadget/udc/dummy_hcd.c          | 1 +
 drivers/usb/gadget/udc/fsl_qe_udc.c         | 1 +
 drivers/usb/gadget/udc/fsl_udc_core.c       | 1 +
 drivers/usb/gadget/udc/fusb300_udc.c        | 1 +
 drivers/usb/gadget/udc/goku_udc.c           | 1 +
 drivers/usb/gadget/udc/gr_udc.c             | 1 +
 drivers/usb/gadget/udc/lpc32xx_udc.c        | 1 +
 drivers/usb/gadget/udc/m66592-udc.c         | 1 +
 drivers/usb/gadget/udc/max3420_udc.c        | 1 +
 drivers/usb/gadget/udc/mv_u3d_core.c        | 2 ++
 drivers/usb/gadget/udc/mv_udc_core.c        | 2 ++
 drivers/usb/gadget/udc/net2272.c            | 1 +
 drivers/usb/gadget/udc/net2280.c            | 2 ++
 drivers/usb/gadget/udc/omap_udc.c           | 1 +
 drivers/usb/gadget/udc/pch_udc.c            | 1 +
 drivers/usb/gadget/udc/pxa25x_udc.c         | 1 +
 drivers/usb/gadget/udc/pxa27x_udc.c         | 1 +
 drivers/usb/gadget/udc/r8a66597-udc.c       | 1 +
 drivers/usb/gadget/udc/renesas_usb3.c       | 1 +
 drivers/usb/gadget/udc/renesas_usbf.c       | 1 +
 drivers/usb/gadget/udc/snps_udc_core.c      | 1 +
 drivers/usb/gadget/udc/tegra-xudc.c         | 2 ++
 drivers/usb/gadget/udc/udc-xilinx.c         | 1 +
 drivers/usb/isp1760/isp1760-udc.c           | 1 +
 drivers/usb/mtu3/mtu3_gadget.c              | 1 +
 drivers/usb/musb/musb_gadget.c              | 1 +
 drivers/usb/renesas_usbhs/mod_gadget.c      | 1 +
 drivers/usb/usbip/vudc_dev.c                | 1 +
 41 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 11a5b3437c32..6abd3a1593bb 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -3109,6 +3109,7 @@ static int cdns3_init_eps(struct cdns3_device *priv_dev)
 		priv_ep->num = ep_number;
 		priv_ep->dir = ep_dir ? USB_DIR_IN : USB_DIR_OUT;
 
+		priv_ep->endpoint.epnum = ep_number;
 		if (!ep_number) {
 			ret = cdns3_init_ep0(priv_dev, priv_ep);
 			if (ret) {
diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index fff9ec9c391f..4225d3c1d0c4 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -1622,6 +1622,7 @@ static int cdnsp_gadget_init_endpoints(struct cdnsp_device *pdev)
 		pep->number = epnum;
 		pep->direction = direction; /* 0 for OUT, 1 for IN. */
 
+		pep->endpoint.epnum = epnum;
 		/*
 		 * Ep0 is bidirectional, so ep0in and ep0out are represented by
 		 * pdev->eps[0]
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0b7bd3c643c3..be05027edbfd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1857,6 +1857,7 @@ static int init_eps(struct ci_hdrc *ci)
 			hwep->lock         = &ci->lock;
 			hwep->td_pool      = ci->td_pool;
 
+			hwep->ep.epnum     = i;
 			hwep->ep.name      = hwep->name;
 			hwep->ep.ops       = &usb_ep_ops;
 
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b517a7216de2..a92931b21b9e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4805,7 +4805,7 @@ static void dwc2_hsotg_initep(struct dwc2_hsotg *hsotg,
 
 	INIT_LIST_HEAD(&hs_ep->queue);
 	INIT_LIST_HEAD(&hs_ep->ep.ep_list);
-
+	hs_ep->ep.epnum = epnum;
 	/* add to the list of endpoints known by the gadget driver */
 	if (epnum)
 		list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list);
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 858fe4c299b7..325d299713f7 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3267,6 +3267,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
 
 	dep->endpoint.name = dep->name;
 
+	dep->endpoint.epnum = num;
 	if (!(dep->number > 1)) {
 		dep->endpoint.desc = &dwc3_gadget_ep0_desc;
 		dep->endpoint.comp_desc = NULL;
diff --git a/drivers/usb/fotg210/fotg210-udc.c b/drivers/usb/fotg210/fotg210-udc.c
index f7ea84070554..f48d57672010 100644
--- a/drivers/usb/fotg210/fotg210-udc.c
+++ b/drivers/usb/fotg210/fotg210-udc.c
@@ -1238,6 +1238,7 @@ int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
 		ep->fotg210 = fotg210;
 		INIT_LIST_HEAD(&ep->queue);
 		ep->ep.name = fotg210_ep_name[i];
+		ep->ep.epnum = i;
 		ep->ep.ops = &fotg210_ep_ops;
 		usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
 
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
index 148d7ec3ebf4..c5f4ec58f520 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
@@ -825,6 +825,7 @@ struct ast_vhub_ep *ast_vhub_alloc_epn(struct ast_vhub_dev *d, u8 addr)
 	ep->d_idx = addr;
 	ep->vhub = vhub;
 	ep->ep.ops = &ast_vhub_epn_ops;
+	ep->ep.epnum = addr;
 	ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", addr);
 	d->epns[addr-1] = ep;
 	ep->epn.g_idx = i;
diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 2ef89a442f50..50c57f86dc4f 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -1355,6 +1355,7 @@ static void ast_udc_init_ep(struct ast_udc_dev *udc)
 
 	for (i = 0; i < AST_UDC_NUM_ENDPOINTS; i++) {
 		ep = &udc->ep[i];
+		ep->ep.epnum = i;
 		ep->ep.name = ast_ep_name[i];
 		if (i == 0) {
 			ep->ep.caps.type_control = true;
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
index 922b4187004b..2905bc60be75 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -1819,6 +1819,7 @@ static int at91udc_probe(struct platform_device *pdev)
 
 	for (i = 0; i < NUM_ENDPOINTS; i++) {
 		ep = &udc->ep[i];
+		ep->ep.epnum = i;
 		ep->ep.name = ep_info[i].name;
 		ep->ep.caps = ep_info[i].caps;
 		ep->ep.ops = &at91_ep_ops;
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 02b1bef5e22e..045b732ac467 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2217,6 +2217,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 		ep->can_dma = ep_cfg->can_dma;
 		ep->can_isoc = ep_cfg->can_isoc;
 
+		ep->ep.epnum = ep->index;
 		sprintf(ep->name, "ep%d", ep->index);
 		ep->ep.name = ep->name;
 
diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
index da7011d906e0..325d37ac2fae 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -952,6 +952,7 @@ 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.epnum = i;
 		bep->ep.name = bcm63xx_ep_info[i].name;
 		bep->ep.caps = bcm63xx_ep_info[i].caps;
 		bep->ep_num = i;
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index fa88f210ecd5..2fc32349823a 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -1977,6 +1977,7 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
 		snprintf(ep->name, sizeof(ep->name), "ep%d%s", epnum - 1,
 			 dir & 1 ? "in" : "out");
 
+		ep->usb_ep.epnum = epnum - 1;
 		usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024);
 		ep->usb_ep.caps.type_iso = true;
 		ep->usb_ep.caps.type_bulk = true;
diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
index 0eed0e03842c..81dcad43025f 100644
--- a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
+++ b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
@@ -2213,7 +2213,7 @@ static int cdns2_init_eps(struct cdns2_device *pdev)
 		} else {
 			snprintf(pep->name, sizeof(pep->name), "ep%d%s",
 				 epnum, !!direction ? "in" : "out");
-			pep->endpoint.name = pep->name;
+			pep->endpoint.epnum = epnum;
 
 			usb_ep_set_maxpacket_limit(&pep->endpoint, 1024);
 			pep->endpoint.ops = &cdns2_gadget_ep_ops;
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 0953e1b5c030..b2c919e46cc5 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -1049,6 +1049,7 @@ static void init_dummy_udc_hw(struct dummy *dum)
 
 		if (!ep_info[i].name)
 			break;
+		ep->ep.epnum = i;
 		ep->ep.name = ep_info[i].name;
 		ep->ep.caps = ep_info[i].caps;
 		ep->ep.ops = &dummy_ep_ops;
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 4aae86b47edf..48a32f8b903d 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -2411,6 +2411,7 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num)
 	ep->udc = udc;
 	strcpy(ep->name, ep_name[pipe_num]);
 	ep->ep.name = ep_name[pipe_num];
+	ep->ep.epnum = pipe_num;
 
 	if (pipe_num == 0) {
 		ep->ep.caps.type_control = true;
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index ee5705d336e3..7841a91aca81 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2331,6 +2331,7 @@ static int struct_ep_setup(struct fsl_udc *udc, unsigned char index,
 	else
 		ep->ep.caps.dir_out = true;
 
+	ep->ep.epnum = index / 2;
 	/* for ep0: maxP defined in desc
 	 * for other eps, maxP is set by epautoconfig() called by gadget layer
 	 */
diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c
index bd03d475f927..a2cc2237c3b1 100644
--- a/drivers/usb/gadget/udc/fusb300_udc.c
+++ b/drivers/usb/gadget/udc/fusb300_udc.c
@@ -1445,6 +1445,7 @@ static int fusb300_probe(struct platform_device *pdev)
 		}
 		ep->fusb300 = fusb300;
 		INIT_LIST_HEAD(&ep->queue);
+		ep->ep.epnum = i;
 		ep->ep.name = fusb300_ep_name[i];
 		ep->ep.ops = &fusb300_ep_ops;
 		usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE);
diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c
index 5ffb3d5c635b..9757c886dd72 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1266,6 +1266,7 @@ static void udc_reinit (struct goku_udc *dev)
 		struct goku_ep	*ep = &dev->ep[i];
 
 		ep->num = i;
+		ep->ep.epnum = i;
 		ep->ep.name = names[i];
 		ep->reg_fifo = &dev->regs->ep_fifo [i];
 		ep->reg_status = &dev->regs->ep_status [i];
diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index c6dfa7cccc11..674de5aea8ed 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -1976,6 +1976,7 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)
 	ep->num = num;
 	ep->is_in = is_in;
 	ep->dev = dev;
+	ep->ep.epnum = num;
 	ep->ep.ops = &gr_ep_ops;
 	INIT_LIST_HEAD(&ep->queue);
 
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index fe62db32dd0e..1d436450adc8 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -1385,6 +1385,7 @@ static void udc_reinit(struct lpc32xx_udc *udc)
 
 		if (i != 0)
 			list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
+		ep->ep.epnum = i;
 		usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
 		INIT_LIST_HEAD(&ep->queue);
 		ep->req_pending = 0;
diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
index e05f45a4b56b..4070b466e109 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1622,6 +1622,7 @@ static int m66592_probe(struct platform_device *pdev)
 		}
 		ep->m66592 = m66592;
 		INIT_LIST_HEAD(&ep->queue);
+		ep->ep.epnum = i;
 		ep->ep.name = m66592_ep_name[i];
 		ep->ep.ops = &m66592_ep_ops;
 		usb_ep_set_maxpacket_limit(&ep->ep, 512);
diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c
index 2d57786d3db7..09bf310df9fa 100644
--- a/drivers/usb/gadget/udc/max3420_udc.c
+++ b/drivers/usb/gadget/udc/max3420_udc.c
@@ -1162,6 +1162,7 @@ static void max3420_eps_init(struct max3420_udc *udc)
 		ep->id = idx;
 		ep->halted = 0;
 		ep->maxpacket = 0;
+		ep->ep_usb.epnum = idx;
 		ep->ep_usb.name = ep->name;
 		ep->ep_usb.ops = &max3420_ep_ops;
 		usb_ep_set_maxpacket_limit(&ep->ep_usb, MAX3420_EP_MAX_PACKET);
diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
index 2a421f0ff931..c77c949edd06 100644
--- a/drivers/usb/gadget/udc/mv_u3d_core.c
+++ b/drivers/usb/gadget/udc/mv_u3d_core.c
@@ -1308,6 +1308,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
 	ep = &u3d->eps[1];
 	ep->u3d = u3d;
 	strncpy(ep->name, "ep0", sizeof(ep->name));
+	ep->ep.epnum = 0;
 	ep->ep.name = ep->name;
 	ep->ep.ops = &mv_u3d_ep_ops;
 	ep->wedge = 0;
@@ -1339,6 +1340,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
 		ep->u3d = u3d;
 		strncpy(ep->name, name, sizeof(ep->name));
 		ep->ep.name = ep->name;
+		ep->ep.epnum = i / 2;
 
 		ep->ep.caps.type_iso = true;
 		ep->ep.caps.type_bulk = true;
diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
index d888dcda2bc8..fdd8dd52d89d 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -1244,6 +1244,7 @@ static int eps_init(struct mv_udc *udc)
 	ep = &udc->eps[0];
 	ep->udc = udc;
 	strncpy(ep->name, "ep0", sizeof(ep->name));
+	ep->ep.epnum = 0;
 	ep->ep.name = ep->name;
 	ep->ep.ops = &mv_ep_ops;
 	ep->wedge = 0;
@@ -1273,6 +1274,7 @@ static int eps_init(struct mv_udc *udc)
 		ep->udc = udc;
 		strncpy(ep->name, name, sizeof(ep->name));
 		ep->ep.name = ep->name;
+		ep->ep.epnum = i / 2;
 
 		ep->ep.caps.type_iso = true;
 		ep->ep.caps.type_bulk = true;
diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index 12e76bb62c20..766aabcbd3d1 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -1373,6 +1373,7 @@ net2272_usb_reinit(struct net2272 *dev)
 		struct net2272_ep *ep = &dev->ep[i];
 
 		ep->ep.name = ep_name[i];
+		ep->ep.epnum = i;
 		ep->dev = dev;
 		ep->num = i;
 		ep->not_empty = 0;
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 1b929c519cd7..b6b3722c0ae6 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -2158,6 +2158,7 @@ static void usb_reinit_228x(struct net2280 *dev)
 
 		ep->ep.name = ep_info_dft[tmp].name;
 		ep->ep.caps = ep_info_dft[tmp].caps;
+		ep->ep.epnum = tmp;
 		ep->dev = dev;
 		ep->num = tmp;
 
@@ -2201,6 +2202,7 @@ static void usb_reinit_338x(struct net2280 *dev)
 						   ep_info_dft[i].name;
 		ep->ep.caps = dev->enhanced_mode ? ep_info_adv[i].caps :
 						   ep_info_dft[i].caps;
+		ep->ep.epnum = i;
 		ep->dev = dev;
 		ep->num = i;
 
diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index 10c5d7f726a1..8baf996fa65a 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -2582,6 +2582,7 @@ omap_ep_setup(char *name, u8 addr, u8 type,
 	else
 		ep->ep.caps.dir_out = true;
 
+	ep->ep.epnum = addr & 0xf;
 	ep->ep.name = ep->name;
 	ep->ep.ops = &omap_ep_ops;
 	ep->maxpacket = maxp;
diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index 4f8617210d85..05247d6f5c61 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -2788,6 +2788,7 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
 		ep->halted = 1;
 		ep->num = i / 2;
 		ep->in = ~i & 1;
+		ep->ep.epnum = i / 2;
 		ep->ep.name = ep_string[i];
 		ep->ep.ops = &pch_udc_ep_ops;
 		if (ep->in) {
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index df0551ecc810..b4e2f018216c 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1392,6 +1392,7 @@ static void udc_reinit(struct pxa25x_udc *dev)
 		if (i != 0)
 			list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list);
 
+		ep->ep.epnum = i;
 		ep->ep.desc = NULL;
 		ep->stopped = 0;
 		INIT_LIST_HEAD (&ep->queue);
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 61424cfd2e1c..8f05937414ca 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -1677,6 +1677,7 @@ static void udc_init_data(struct pxa_udc *dev)
 
 	/* USB endpoints init */
 	for (i = 1; i < NR_USB_ENDPOINTS; i++) {
+		dev->udc_usb_ep[i].usb_ep.epnum = i;
 		list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list,
 				&dev->gadget.ep_list);
 		usb_ep_set_maxpacket_limit(&dev->udc_usb_ep[i].usb_ep,
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
index 51b665f15c8e..eb3cd4446e39 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1912,6 +1912,7 @@ static int r8a66597_probe(struct platform_device *pdev)
 		}
 		ep->r8a66597 = r8a66597;
 		INIT_LIST_HEAD(&ep->queue);
+		ep->ep.epnum = i;
 		ep->ep.name = r8a66597_ep_name[i];
 		ep->ep.ops = &r8a66597_ep_ops;
 		usb_ep_set_maxpacket_limit(&ep->ep, 512);
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 3b01734ce1b7..f1bf719022fb 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2700,6 +2700,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev,
 		snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
 		usb3_ep->usb3 = usb3;
 		usb3_ep->num = i;
+		usb3_ep->ep.epnum = i;
 		usb3_ep->ep.name = usb3_ep->ep_name;
 		usb3_ep->ep.ops = &renesas_usb3_ep_ops;
 		INIT_LIST_HEAD(&usb3_ep->queue);
diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c
index 657f265ac7cc..cb741e54ea4c 100644
--- a/drivers/usb/gadget/udc/renesas_usbf.c
+++ b/drivers/usb/gadget/udc/renesas_usbf.c
@@ -3308,6 +3308,7 @@ static int usbf_probe(struct platform_device *pdev)
 		ep->id = i;
 		ep->disabled = 1;
 		ep->udc = udc;
+		ep->ep.epnum = i;
 		ep->ep.ops = &usbf_ep_ops;
 		ep->ep.name = usbf_ep_info[i].name;
 		ep->ep.caps = usbf_ep_info[i].caps;
diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
index 2fc5d4d277bc..feeea53787ee 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -1538,6 +1538,7 @@ static void udc_setup_endpoints(struct udc *dev)
 	for (tmp = 0; tmp < UDC_EP_NUM; tmp++) {
 		ep = &dev->ep[tmp];
 		ep->dev = dev;
+		ep->ep.epnum = tmp;
 		ep->ep.name = ep_info[tmp].name;
 		ep->ep.caps = ep_info[tmp].caps;
 		ep->num = tmp;
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index cb85168fd00c..d699001f2254 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -3173,6 +3173,7 @@ static int tegra_xudc_alloc_ep(struct tegra_xudc *xudc, unsigned int index)
 	if (index) {
 		snprintf(ep->name, sizeof(ep->name), "ep%u%s", index / 2,
 			 (index % 2 == 0) ? "out" : "in");
+		ep->usb_ep.epnum = index / 2;
 		ep->usb_ep.name = ep->name;
 		usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024);
 		ep->usb_ep.max_streams = 16;
@@ -3186,6 +3187,7 @@ static int tegra_xudc_alloc_ep(struct tegra_xudc *xudc, unsigned int index)
 		list_add_tail(&ep->usb_ep.ep_list, &xudc->gadget.ep_list);
 	} else {
 		strscpy(ep->name, "ep0", 3);
+		ep->usb_ep.epnum = 0;
 		ep->usb_ep.name = ep->name;
 		usb_ep_set_maxpacket_limit(&ep->usb_ep, 512);
 		ep->usb_ep.ops = &tegra_xudc_ep0_ops;
diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index 56b8286a8009..f04e26a8f6d3 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -1324,6 +1324,7 @@ static void xudc_eps_init(struct xusb_udc *udc)
 			ep->ep_usb.caps.type_control = true;
 		}
 
+		ep->ep_usb.epnum = ep_number;
 		ep->ep_usb.caps.dir_in = true;
 		ep->ep_usb.caps.dir_out = true;
 
diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c
index 5cafd23345ca..a6f83ff661ad 100644
--- a/drivers/usb/isp1760/isp1760-udc.c
+++ b/drivers/usb/isp1760/isp1760-udc.c
@@ -1466,6 +1466,7 @@ static void isp1760_udc_init_eps(struct isp1760_udc *udc)
 		ep->ep.ops = &isp1760_ep_ops;
 		ep->ep.name = ep->name;
 
+		ep->ep.epnum = ep_num;
 		/*
 		 * Hardcode the maximum packet sizes for now, to 64 bytes for
 		 * the control endpoint and 512 bytes for all other endpoints.
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index ad0eeac4332d..bc76339eef16 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -655,6 +655,7 @@ static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep,
 	sprintf(mep->name, "ep%d%s", epnum,
 		!epnum ? "" : (is_in ? "in" : "out"));
 
+	mep->ep.epnum = epnum;
 	mep->ep.name = mep->name;
 	INIT_LIST_HEAD(&mep->ep.ep_list);
 
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 051c6da7cf6d..1aab514d39f2 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1709,6 +1709,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
 			(!epnum || hw_ep->is_shared_fifo) ? "" : (
 				is_in ? "in" : "out"));
 	ep->end_point.name = ep->name;
+	ep->end_point.epnum = epnum;
 	INIT_LIST_HEAD(&ep->end_point.ep_list);
 	if (!epnum) {
 		usb_ep_set_maxpacket_limit(&ep->end_point, 64);
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 105132ae87ac..648bee7e5198 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -1139,6 +1139,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
 		uep->pipe	= NULL;
 		snprintf(uep->ep_name, EP_NAME_SIZE, "ep%d", i);
 
+		uep->ep.epnum = i;
 		uep->ep.name		= uep->ep_name;
 		uep->ep.ops		= &usbhsg_ep_ops;
 		INIT_LIST_HEAD(&uep->ep.ep_list);
diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 44b04c54c086..05c95d9ebd8e 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -535,6 +535,7 @@ static int init_vudc_hw(struct vudc *udc)
 			i ? (is_out ? "out" : "in") : "");
 		ep->ep.name = ep->name;
 
+		ep->ep.epnum = num;
 		ep->ep.ops = &vep_ops;
 
 		usb_ep_set_maxpacket_limit(&ep->ep, ~0);
-- 
2.17.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux