X-Git-Url: http://git.onelab.eu/?p=linux-2.6.git;a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fuhci-hub.c;fp=drivers%2Fusb%2Fhost%2Fuhci-hub.c;h=152971d167695580bc69282091888cc1b962ea90;hp=c545ef92fe29ad130a7b1de0088a945e4bd29751;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index c545ef92f..152971d16 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c @@ -85,10 +85,11 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, { int status; - if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) { + if (test_bit(port, &uhci->suspended_ports)) { CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); - if (test_bit(port, &uhci->resuming_ports)) - set_bit(port, &uhci->port_c_suspend); + clear_bit(port, &uhci->suspended_ports); + clear_bit(port, &uhci->resuming_ports); + set_bit(port, &uhci->port_c_suspend); /* The controller won't actually turn off the RD bit until * it has had a chance to send a low-speed EOP sequence, @@ -96,7 +97,6 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, * slightly longer for good luck. */ udelay(4); } - clear_bit(port, &uhci->resuming_ports); } /* Wait for the UHCI controller in HP's iLO2 server management chip. @@ -171,8 +171,9 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) spin_lock_irqsave(&uhci->lock, flags); uhci_scan_schedule(uhci, NULL); - if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) + if (uhci->hc_inaccessible) goto done; + check_fsbr(uhci); uhci_check_ports(uhci); status = get_hub_status_data(uhci, buf); @@ -227,7 +228,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wPortChange, wPortStatus; unsigned long flags; - if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) + if (uhci->hc_inaccessible) return -ETIMEDOUT; spin_lock_irqsave(&uhci->lock, flags); @@ -264,6 +265,8 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, wPortChange |= USB_PORT_STAT_C_SUSPEND; lstatus |= 1; } + if (test_bit(port, &uhci->suspended_ports)) + lstatus |= 2; if (test_bit(port, &uhci->resuming_ports)) lstatus |= 4; @@ -306,6 +309,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, switch (wValue) { case USB_PORT_FEAT_SUSPEND: + set_bit(port, &uhci->suspended_ports); SET_RH_PORTSTAT(USBPORTSC_SUSP); OK(0); case USB_PORT_FEAT_RESET: @@ -339,11 +343,8 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, CLR_RH_PORTSTAT(USBPORTSC_PEC); OK(0); case USB_PORT_FEAT_SUSPEND: - if (!(inw(port_addr) & USBPORTSC_SUSP)) { - - /* Make certain the port isn't suspended */ - uhci_finish_suspend(uhci, port, port_addr); - } else if (!test_and_set_bit(port, + if (test_bit(port, &uhci->suspended_ports) && + !test_and_set_bit(port, &uhci->resuming_ports)) { SET_RH_PORTSTAT(USBPORTSC_RD);