Commit 978def1c authored by Ido Shayevitz's avatar Ido Shayevitz Committed by Felipe Balbi

usb: gadget: Update atmel_usba_udc to use usb_endpoint_descriptor inside the struct usb_ep

Remove redundant pointer to struct usb_endpoint_descriptor.
Signed-off-by: default avatarIdo Shayevitz <idos@codeaurora.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5a6506f0
...@@ -599,13 +599,13 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -599,13 +599,13 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
spin_lock_irqsave(&ep->udc->lock, flags); spin_lock_irqsave(&ep->udc->lock, flags);
if (ep->desc) { if (ep->ep.desc) {
spin_unlock_irqrestore(&ep->udc->lock, flags); spin_unlock_irqrestore(&ep->udc->lock, flags);
DBG(DBG_ERR, "ep%d already enabled\n", ep->index); DBG(DBG_ERR, "ep%d already enabled\n", ep->index);
return -EBUSY; return -EBUSY;
} }
ep->desc = desc; ep->ep.desc = desc;
ep->ep.maxpacket = maxpacket; ep->ep.maxpacket = maxpacket;
usba_ep_writel(ep, CFG, ept_cfg); usba_ep_writel(ep, CFG, ept_cfg);
...@@ -647,7 +647,7 @@ static int usba_ep_disable(struct usb_ep *_ep) ...@@ -647,7 +647,7 @@ static int usba_ep_disable(struct usb_ep *_ep)
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
if (!ep->desc) { if (!ep->ep.desc) {
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
/* REVISIT because this driver disables endpoints in /* REVISIT because this driver disables endpoints in
* reset_all_endpoints() before calling disconnect(), * reset_all_endpoints() before calling disconnect(),
...@@ -658,7 +658,6 @@ static int usba_ep_disable(struct usb_ep *_ep) ...@@ -658,7 +658,6 @@ static int usba_ep_disable(struct usb_ep *_ep)
ep->ep.name); ep->ep.name);
return -EINVAL; return -EINVAL;
} }
ep->desc = NULL;
ep->ep.desc = NULL; ep->ep.desc = NULL;
list_splice_init(&ep->queue, &req_list); list_splice_init(&ep->queue, &req_list);
...@@ -752,7 +751,7 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep, ...@@ -752,7 +751,7 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep,
*/ */
ret = -ESHUTDOWN; ret = -ESHUTDOWN;
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
if (ep->desc) { if (ep->ep.desc) {
if (list_empty(&ep->queue)) if (list_empty(&ep->queue))
submit_request(ep, req); submit_request(ep, req);
...@@ -776,7 +775,8 @@ usba_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) ...@@ -776,7 +775,8 @@ usba_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
DBG(DBG_GADGET | DBG_QUEUE | DBG_REQ, "%s: queue req %p, len %u\n", DBG(DBG_GADGET | DBG_QUEUE | DBG_REQ, "%s: queue req %p, len %u\n",
ep->ep.name, req, _req->length); ep->ep.name, req, _req->length);
if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN || !ep->desc) if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN ||
!ep->ep.desc)
return -ESHUTDOWN; return -ESHUTDOWN;
req->submitted = 0; req->submitted = 0;
...@@ -792,7 +792,7 @@ usba_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) ...@@ -792,7 +792,7 @@ usba_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
/* May have received a reset since last time we checked */ /* May have received a reset since last time we checked */
ret = -ESHUTDOWN; ret = -ESHUTDOWN;
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
if (ep->desc) { if (ep->ep.desc) {
list_add_tail(&req->queue, &ep->queue); list_add_tail(&req->queue, &ep->queue);
if ((!ep_is_control(ep) && ep->is_in) || if ((!ep_is_control(ep) && ep->is_in) ||
...@@ -905,7 +905,7 @@ static int usba_ep_set_halt(struct usb_ep *_ep, int value) ...@@ -905,7 +905,7 @@ static int usba_ep_set_halt(struct usb_ep *_ep, int value)
DBG(DBG_GADGET, "endpoint %s: %s HALT\n", ep->ep.name, DBG(DBG_GADGET, "endpoint %s: %s HALT\n", ep->ep.name,
value ? "set" : "clear"); value ? "set" : "clear");
if (!ep->desc) { if (!ep->ep.desc) {
DBG(DBG_ERR, "Attempted to halt uninitialized ep %s\n", DBG(DBG_ERR, "Attempted to halt uninitialized ep %s\n",
ep->ep.name); ep->ep.name);
return -ENODEV; return -ENODEV;
...@@ -1071,7 +1071,7 @@ static void reset_all_endpoints(struct usba_udc *udc) ...@@ -1071,7 +1071,7 @@ static void reset_all_endpoints(struct usba_udc *udc)
* FIXME remove this code ... and retest thoroughly. * FIXME remove this code ... and retest thoroughly.
*/ */
list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
if (ep->desc) { if (ep->ep.desc) {
spin_unlock(&udc->lock); spin_unlock(&udc->lock);
usba_ep_disable(&ep->ep); usba_ep_disable(&ep->ep);
spin_lock(&udc->lock); spin_lock(&udc->lock);
...@@ -1089,9 +1089,9 @@ static struct usba_ep *get_ep_by_addr(struct usba_udc *udc, u16 wIndex) ...@@ -1089,9 +1089,9 @@ static struct usba_ep *get_ep_by_addr(struct usba_udc *udc, u16 wIndex)
list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) { list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) {
u8 bEndpointAddress; u8 bEndpointAddress;
if (!ep->desc) if (!ep->ep.desc)
continue; continue;
bEndpointAddress = ep->desc->bEndpointAddress; bEndpointAddress = ep->ep.desc->bEndpointAddress;
if ((wIndex ^ bEndpointAddress) & USB_DIR_IN) if ((wIndex ^ bEndpointAddress) & USB_DIR_IN)
continue; continue;
if ((bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) if ((bEndpointAddress & USB_ENDPOINT_NUMBER_MASK)
...@@ -1727,7 +1727,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ...@@ -1727,7 +1727,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
usb_speed_string(udc->gadget.speed)); usb_speed_string(udc->gadget.speed));
ep0 = &usba_ep[0]; ep0 = &usba_ep[0];
ep0->desc = &usba_ep0_desc; ep0->ep.desc = &usba_ep0_desc;
ep0->state = WAIT_FOR_SETUP; ep0->state = WAIT_FOR_SETUP;
usba_ep_writel(ep0, CFG, usba_ep_writel(ep0, CFG,
(USBA_BF(EPT_SIZE, EP0_EPT_SIZE) (USBA_BF(EPT_SIZE, EP0_EPT_SIZE)
......
...@@ -280,7 +280,6 @@ struct usba_ep { ...@@ -280,7 +280,6 @@ struct usba_ep {
struct usba_udc *udc; struct usba_udc *udc;
struct list_head queue; struct list_head queue;
const struct usb_endpoint_descriptor *desc;
u16 fifo_size; u16 fifo_size;
u8 nr_banks; u8 nr_banks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment