From bad9dab0fc6e0d1101a6816eeb0ec4fb17d4721c Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 31 May 2005 16:33:21 -0400 Subject: [PATCH] --- yaml --- r: 3705 b: refs/heads/master c: e07fefa6b212f43c40fdbc1a62de690d91a4b617 h: refs/heads/master i: 3703: d523e59857366ea32a0ed79c1a66a7a0c01cc986 v: v3 --- [refs] | 2 +- trunk/drivers/usb/host/uhci-hcd.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 10da106175d6..bc6aeba65ec9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 486e2df6ce213d0c776befdf3fe5ffc61dd61688 +refs/heads/master: e07fefa6b212f43c40fdbc1a62de690d91a4b617 diff --git a/trunk/drivers/usb/host/uhci-hcd.c b/trunk/drivers/usb/host/uhci-hcd.c index fdf54295da73..0d5d2545bf07 100644 --- a/trunk/drivers/usb/host/uhci-hcd.c +++ b/trunk/drivers/usb/host/uhci-hcd.c @@ -495,24 +495,24 @@ static int uhci_reset(struct usb_hcd *hcd) /* The UHCI spec says devices must have 2 ports, and goes on to say * they may have more but gives no way to determine how many there - * are. However, according to the UHCI spec, Bit 7 of the port + * are. However according to the UHCI spec, Bit 7 of the port * status and control register is always set to 1. So we try to - * use this to our advantage. + * use this to our advantage. Another common failure mode when + * a nonexistent register is addressed is to return all ones, so + * we test for that also. */ for (port = 0; port < (io_size - USBPORTSC1) / 2; port++) { unsigned int portstatus; portstatus = inw(uhci->io_addr + USBPORTSC1 + (port * 2)); - if (!(portstatus & 0x0080)) + if (!(portstatus & 0x0080) || portstatus == 0xffff) break; } if (debug) dev_info(uhci_dev(uhci), "detected %d ports\n", port); - /* Anything less than 2 or greater than 7 is weird, - * so we'll ignore it. - */ - if (port < 2 || port > UHCI_RH_MAXCHILD) { + /* Anything greater than 7 is weird so we'll ignore it. */ + if (port > UHCI_RH_MAXCHILD) { dev_info(uhci_dev(uhci), "port count misdetected? " "forcing to 2 ports\n"); port = 2;