[PATCH 10/18] usb: gadget: Update langwell_udc to use usb_endpoint_descriptor inside the struct usb_ep

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

 



Remove redundant pointer to struct usb_endpoint_descriptor.

Signed-off-by: Ido Shayevitz <idos@xxxxxxxxxxxxxx>
---
 drivers/usb/gadget/langwell_udc.c |   35 +++++++++++++++++------------------
 drivers/usb/gadget/langwell_udc.h |    1 -
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index edd52d9..dc50577 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -155,7 +155,7 @@ static inline void print_all_registers(struct langwell_udc *dev)
 /*-------------------------------------------------------------------------*/
 
 #define	is_in(ep)	(((ep)->ep_num == 0) ? ((ep)->dev->ep0_dir ==	\
-			USB_DIR_IN) : (usb_endpoint_dir_in((ep)->desc)))
+			USB_DIR_IN) : (usb_endpoint_dir_in((ep)->ep.desc)))
 
 #define	DIR_STRING(ep)	(is_in(ep) ? "in" : "out")
 
@@ -258,7 +258,7 @@ static int langwell_ep_enable(struct usb_ep *_ep,
 	dev = ep->dev;
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !desc || ep->desc
+	if (!_ep || !desc || ep->ep.desc
 			|| desc->bDescriptorType != USB_DT_ENDPOINT)
 		return -EINVAL;
 
@@ -338,7 +338,7 @@ static int langwell_ep_enable(struct usb_ep *_ep,
 	spin_lock_irqsave(&dev->lock, flags);
 
 	ep->ep.maxpacket = max;
-	ep->desc = desc;
+	ep->ep.desc = desc;
 	ep->stopped = 0;
 	ep->ep_num = usb_endpoint_num(desc);
 
@@ -433,7 +433,7 @@ static void nuke(struct langwell_ep *ep, int status)
 	ep->stopped = 1;
 
 	/* endpoint fifo flush */
-	if (&ep->ep && ep->desc)
+	if (&ep->ep && ep->ep.desc)
 		langwell_ep_fifo_flush(&ep->ep);
 
 	while (!list_empty(&ep->queue)) {
@@ -460,7 +460,7 @@ static int langwell_ep_disable(struct usb_ep *_ep)
 	dev = ep->dev;
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !ep->desc)
+	if (!_ep || !ep->ep.desc)
 		return -EINVAL;
 
 	spin_lock_irqsave(&dev->lock, flags);
@@ -477,7 +477,6 @@ static int langwell_ep_disable(struct usb_ep *_ep)
 	/* nuke all pending requests (does flush) */
 	nuke(ep, -ESHUTDOWN);
 
-	ep->desc = NULL;
 	ep->ep.desc = NULL;
 	ep->stopped = 1;
 
@@ -753,14 +752,14 @@ static int langwell_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
 		return -EINVAL;
 	}
 
-	if (unlikely(!_ep || !ep->desc))
+	if (unlikely(!_ep || !ep->ep.desc))
 		return -EINVAL;
 
 	dev = ep->dev;
 	req->ep = ep;
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (usb_endpoint_xfer_isoc(ep->desc)) {
+	if (usb_endpoint_xfer_isoc(ep->ep.desc)) {
 		if (req->req.length > ep->ep.maxpacket)
 			return -EMSGSIZE;
 		is_iso = 1;
@@ -823,7 +822,7 @@ static int langwell_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 	dev = ep->dev;
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !ep->desc || !_req)
+	if (!_ep || !ep->ep.desc || !_req)
 		return -EINVAL;
 
 	if (!dev->driver)
@@ -951,13 +950,13 @@ static int langwell_ep_set_halt(struct usb_ep *_ep, int value)
 
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !ep->desc)
+	if (!_ep || !ep->ep.desc)
 		return -EINVAL;
 
 	if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)
 		return -ESHUTDOWN;
 
-	if (usb_endpoint_xfer_isoc(ep->desc))
+	if (usb_endpoint_xfer_isoc(ep->ep.desc))
 		return  -EOPNOTSUPP;
 
 	spin_lock_irqsave(&dev->lock, flags);
@@ -1000,7 +999,7 @@ static int langwell_ep_set_wedge(struct usb_ep *_ep)
 
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !ep->desc)
+	if (!_ep || !ep->ep.desc)
 		return -EINVAL;
 
 	dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
@@ -1021,8 +1020,8 @@ static void langwell_ep_fifo_flush(struct usb_ep *_ep)
 
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
-	if (!_ep || !ep->desc) {
-		dev_vdbg(&dev->pdev->dev, "ep or ep->desc is NULL\n");
+	if (!_ep || !ep->ep.desc) {
+		dev_vdbg(&dev->pdev->dev, "ep or ep->ep.desc is NULL\n");
 		dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
 		return;
 	}
@@ -1403,7 +1402,7 @@ static int eps_reinit(struct langwell_udc *dev)
 	ep->stopped = 0;
 	ep->ep.maxpacket = EP0_MAX_PKT_SIZE;
 	ep->ep_num = 0;
-	ep->desc = &langwell_ep0_desc;
+	ep->ep.desc = &langwell_ep0_desc;
 	INIT_LIST_HEAD(&ep->queue);
 
 	ep->ep_type = USB_ENDPOINT_XFER_CONTROL;
@@ -1738,7 +1737,7 @@ static ssize_t show_langwell_udc(struct device *_dev,
 	}
 	/* other gadget->eplist ep */
 	list_for_each_entry(ep, &dev->gadget.ep_list, ep.ep_list) {
-		if (ep->desc) {
+		if (ep->ep.desc) {
 			t = scnprintf(next, size,
 					"\n%s MaxPacketSize: 0x%x, "
 					"ep_num: %d\n",
@@ -2047,10 +2046,10 @@ static struct langwell_ep *get_ep_by_windex(struct langwell_udc *dev,
 
 	list_for_each_entry(ep, &dev->gadget.ep_list, ep.ep_list) {
 		u8	bEndpointAddress;
-		if (!ep->desc)
+		if (!ep->ep.desc)
 			continue;
 
-		bEndpointAddress = ep->desc->bEndpointAddress;
+		bEndpointAddress = ep->ep.desc->bEndpointAddress;
 		if ((wIndex ^ bEndpointAddress) & USB_DIR_IN)
 			continue;
 
diff --git a/drivers/usb/gadget/langwell_udc.h b/drivers/usb/gadget/langwell_udc.h
index 8c8087a..38fa3c8 100644
--- a/drivers/usb/gadget/langwell_udc.h
+++ b/drivers/usb/gadget/langwell_udc.h
@@ -116,7 +116,6 @@ struct langwell_ep {
 	unsigned long		irqs;
 	struct list_head	queue;
 	struct langwell_dqh	*dqh;
-	const struct usb_endpoint_descriptor	*desc;
 	char			name[14];
 	unsigned		stopped:1,
 				ep_type:2,
-- 
1.7.6

--
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux