aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-hub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-hub.c')
-rw-r--r--drivers/usb/host/ehci-hub.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index ffc90295a95f..74f62d68f013 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -872,15 +872,23 @@ int ehci_hub_control(
872) { 872) {
873 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 873 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
874 int ports = HCS_N_PORTS (ehci->hcs_params); 874 int ports = HCS_N_PORTS (ehci->hcs_params);
875 u32 __iomem *status_reg = &ehci->regs->port_status[ 875 u32 __iomem *status_reg, *hostpc_reg;
876 (wIndex & 0xff) - 1];
877 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];
878 u32 temp, temp1, status; 876 u32 temp, temp1, status;
879 unsigned long flags; 877 unsigned long flags;
880 int retval = 0; 878 int retval = 0;
881 unsigned selector; 879 unsigned selector;
882 880
883 /* 881 /*
882 * Avoid underflow while calculating (wIndex & 0xff) - 1.
883 * The compiler might deduce that wIndex can never be 0 and then
884 * optimize away the tests for !wIndex below.
885 */
886 temp = wIndex & 0xff;
887 temp -= (temp > 0);
888 status_reg = &ehci->regs->port_status[temp];
889 hostpc_reg = &ehci->regs->hostpc[temp];
890
891 /*
884 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. 892 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR.
885 * HCS_INDICATOR may say we can change LEDs to off/amber/green. 893 * HCS_INDICATOR may say we can change LEDs to off/amber/green.
886 * (track current state ourselves) ... blink for diagnostics, 894 * (track current state ourselves) ... blink for diagnostics,