Skip to content

Commit

Permalink
usb: gadget: Update fsl_qe_udc to use usb_endpoint_descriptor inside …
Browse files Browse the repository at this point in the history
…the struct usb_ep

Remove redundant pointer to struct usb_endpoint_descriptor.

Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Ido Shayevitz authored and Felipe Balbi committed May 4, 2012
1 parent 978def1 commit ec39e2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
19 changes: 9 additions & 10 deletions drivers/usb/gadget/fsl_qe_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@ static int qe_ep_register_init(struct qe_udc *udc, unsigned char pipe_num)
epparam = udc->ep_param[pipe_num];

usep = 0;
logepnum = (ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
logepnum = (ep->ep.desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
usep |= (logepnum << USB_EPNUM_SHIFT);

switch (ep->desc->bmAttributes & 0x03) {
switch (ep->ep.desc->bmAttributes & 0x03) {
case USB_ENDPOINT_XFER_BULK:
usep |= USB_TRANS_BULK;
break;
Expand Down Expand Up @@ -644,7 +644,7 @@ static int qe_ep_init(struct qe_udc *udc,
/* initialize ep structure */
ep->ep.maxpacket = max;
ep->tm = (u8)(desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
ep->desc = desc;
ep->ep.desc = desc;
ep->stopped = 0;
ep->init = 1;

Expand Down Expand Up @@ -1599,7 +1599,7 @@ static int qe_ep_enable(struct usb_ep *_ep,
ep = container_of(_ep, struct qe_ep, ep);

/* catch various bogus parameters */
if (!_ep || !desc || ep->desc || _ep->name == ep_name[0] ||
if (!_ep || !desc || ep->ep.desc || _ep->name == ep_name[0] ||
(desc->bDescriptorType != USB_DT_ENDPOINT))
return -EINVAL;

Expand Down Expand Up @@ -1629,15 +1629,14 @@ static int qe_ep_disable(struct usb_ep *_ep)
ep = container_of(_ep, struct qe_ep, ep);
udc = ep->udc;

if (!_ep || !ep->desc) {
if (!_ep || !ep->ep.desc) {
dev_dbg(udc->dev, "%s not enabled\n", _ep ? ep->ep.name : NULL);
return -EINVAL;
}

spin_lock_irqsave(&udc->lock, flags);
/* Nuke all pending requests (does flush) */
nuke(ep, -ESHUTDOWN);
ep->desc = NULL;
ep->ep.desc = NULL;
ep->stopped = 1;
ep->tx_req = NULL;
Expand Down Expand Up @@ -1715,7 +1714,7 @@ static int __qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req)
dev_dbg(udc->dev, "bad params\n");
return -EINVAL;
}
if (!_ep || (!ep->desc && ep_index(ep))) {
if (!_ep || (!ep->ep.desc && ep_index(ep))) {
dev_dbg(udc->dev, "bad ep\n");
return -EINVAL;
}
Expand Down Expand Up @@ -1826,7 +1825,7 @@ static int qe_ep_set_halt(struct usb_ep *_ep, int value)
struct qe_udc *udc;

ep = container_of(_ep, struct qe_ep, ep);
if (!_ep || !ep->desc) {
if (!_ep || !ep->ep.desc) {
status = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -2015,7 +2014,7 @@ static void ch9getstatus(struct qe_udc *udc, u8 request_type, u16 value,
u16 usep;

/* stall if endpoint doesn't exist */
if (!target_ep->desc)
if (!target_ep->ep.desc)
goto stall;

usep = in_be16(&udc->usb_regs->usb_usep[pipe]);
Expand Down Expand Up @@ -2502,7 +2501,7 @@ static int __devinit qe_ep_config(struct qe_udc *udc, unsigned char pipe_num)
ep->ep.ops = &qe_ep_ops;
ep->stopped = 1;
ep->ep.maxpacket = (unsigned short) ~0;
ep->desc = NULL;
ep->ep.desc = NULL;
ep->dir = 0xff;
ep->epnum = (u8)pipe_num;
ep->sent = 0;
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/gadget/fsl_qe_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ struct qe_ep {
struct usb_ep ep;
struct list_head queue;
struct qe_udc *udc;
const struct usb_endpoint_descriptor *desc;
struct usb_gadget *gadget;

u8 state;
Expand Down

0 comments on commit ec39e2a

Please sign in to comment.