From 484a1fb56890fee13a73070e0d868a3349a47c19 Mon Sep 17 00:00:00 2001 From: Kuo-Jung Su Date: Tue, 25 Aug 2015 15:59:58 +0300 Subject: usb: ehci: replace multiple use of le16_to_cpu(req->index) with variable This is part of U-Boot commit: 7d9aa8f usb: Add new command to set USB 2.0 port test modes Signed-off-by: Sascha Hauer --- drivers/usb/host/ehci-hcd.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 0e7c595865..8a6bbc9fb3 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -475,10 +475,11 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, int len, srclen; uint32_t reg; uint32_t *status_reg; + int port = le16_to_cpu(req->index); if (le16_to_cpu(req->index) >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) { dev_err(ehci->dev, "The request port(%d) is not configured\n", - le16_to_cpu(req->index) - 1); + port - 1); return -1; } status_reg = (uint32_t *)&ehci->hcor->or_portsc[le16_to_cpu(req->index) - 1]; @@ -570,7 +571,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, if (reg & EHCI_PS_OCA) tmpbuf[0] |= USB_PORT_STAT_OVERCURRENT; if (reg & EHCI_PS_PR && - (ehci->portreset & (1 << le16_to_cpu(req->index)))) { + (ehci->portreset & (1 << port))) { int ret; /* force reset to complete */ reg = reg & ~(EHCI_PS_PR | EHCI_PS_CLEAR); @@ -580,7 +581,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, tmpbuf[0] |= USB_PORT_STAT_RESET; else dev_err(ehci->dev, "port(%d) reset error\n", - le16_to_cpu(req->index) - 1); + port - 1); } if (reg & EHCI_PS_PP) tmpbuf[1] |= USB_PORT_STAT_POWER >> 8; @@ -607,7 +608,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, tmpbuf[2] |= USB_PORT_STAT_C_ENABLE; if (reg & EHCI_PS_OCC) tmpbuf[2] |= USB_PORT_STAT_C_OVERCURRENT; - if (ehci->portreset & (1 << le16_to_cpu(req->index))) + if (ehci->portreset & (1 << port)) tmpbuf[2] |= USB_PORT_STAT_C_RESET; srcptr = tmpbuf; @@ -633,7 +634,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, EHCI_PS_IS_LOWSPEED(reg)) { /* Low speed device, give up ownership. */ dev_dbg(ehci->dev, "port %d low speed --> companion\n", - req->index - 1); + port - 1); reg |= EHCI_PS_PO; ehci_writel(status_reg, reg); break; @@ -650,7 +651,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, */ ehci_powerup_fixup(ehci); mdelay(50); - ehci->portreset |= 1 << le16_to_cpu(req->index); + ehci->portreset |= 1 << port; /* terminate the reset */ ehci_writel(status_reg, reg & ~EHCI_PS_PR); /* @@ -662,10 +663,10 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, 2 * 1000); if (!ret) ehci->portreset |= - 1 << le16_to_cpu(req->index); + 1 << port; else dev_err(ehci->dev, "port(%d) reset error\n", - le16_to_cpu(req->index) - 1); + port - 1); } break; @@ -697,7 +698,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer, reg |= EHCI_PS_OCC; break; case USB_PORT_FEAT_C_RESET: - ehci->portreset &= ~(1 << le16_to_cpu(req->index)); + ehci->portreset &= ~(1 << port); break; default: dev_dbg(ehci->dev, "unknown feature %x\n", le16_to_cpu(req->value)); -- cgit v1.2.3