--- zzzz-none-000/linux-3.10.107/drivers/usb/host/ohci-hub.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/host/ohci-hub.c 2021-02-04 17:41:59.000000000 +0000 @@ -39,8 +39,8 @@ #define OHCI_SCHED_ENABLES \ (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) -static void dl_done_list (struct ohci_hcd *); -static void finish_unlinks (struct ohci_hcd *, u16); +static void update_done_list(struct ohci_hcd *); +static void ohci_work(struct ohci_hcd *); #ifdef CONFIG_PM static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop) @@ -87,8 +87,8 @@ msleep (8); spin_lock_irq (&ohci->lock); } - dl_done_list (ohci); - finish_unlinks (ohci, ohci_frame_no(ohci)); + update_done_list(ohci); + ohci_work(ohci); /* * Some controllers don't handle "global" suspend properly if @@ -194,7 +194,6 @@ if (status == -EBUSY) { if (!autostopped) { spin_unlock_irq (&ohci->lock); - (void) ohci_init (ohci); status = ohci_restart (ohci); usb_root_hub_lost_power(hcd->self.root_hub); @@ -231,10 +230,11 @@ /* Sometimes PCI D3 suspend trashes frame timings ... */ periodic_reinit (ohci); - /* the following code is executed with ohci->lock held and - * irqs disabled if and only if autostopped is true + /* + * The following code is executed with ohci->lock held and + * irqs disabled if and only if autostopped is true. This + * will cause sparse to warn about a "context imbalance". */ - skip_resume: /* interrupts might have been disabled */ ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable); @@ -309,6 +309,9 @@ else rc = ohci_rh_suspend (ohci, 0); spin_unlock_irq (&ohci->lock); + + if (rc == 0) + del_timer_sync(&ohci->io_watchdog); return rc; } @@ -456,8 +459,7 @@ /* build "status change" packet (one or two bytes) from HC registers */ -static int -ohci_hub_status_data (struct usb_hcd *hcd, char *buf) +int ohci_hub_status_data(struct usb_hcd *hcd, char *buf) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); int i, changed = 0, length = 1; @@ -522,6 +524,7 @@ return changed ? length : 0; } +EXPORT_SYMBOL_GPL(ohci_hub_status_data); /*-------------------------------------------------------------------------*/ @@ -533,7 +536,7 @@ u32 rh = roothub_a (ohci); u16 temp; - desc->bDescriptorType = 0x29; + desc->bDescriptorType = USB_DT_HUB; desc->bPwrOn2PwrGood = (rh & RH_A_POTPGT) >> 24; desc->bHubContrCurrent = 0; @@ -541,16 +544,16 @@ temp = 1 + (ohci->num_ports / 8); desc->bDescLength = 7 + 2 * temp; - temp = 0; + temp = HUB_CHAR_COMMON_LPSM | HUB_CHAR_COMMON_OCPM; if (rh & RH_A_NPS) /* no power switching? */ - temp |= 0x0002; + temp |= HUB_CHAR_NO_LPSM; if (rh & RH_A_PSM) /* per-port power switching? */ - temp |= 0x0001; + temp |= HUB_CHAR_INDV_PORT_LPSM; if (rh & RH_A_NOCP) /* no overcurrent reporting? */ - temp |= 0x0010; + temp |= HUB_CHAR_NO_OCPM; else if (rh & RH_A_OCPM) /* per-port overcurrent reporting? */ - temp |= 0x0008; - desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ohci, temp); + temp |= HUB_CHAR_INDV_PORT_OCPM; + desc->wHubCharacteristics = cpu_to_le16(temp); /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */ rh = roothub_b (ohci); @@ -582,7 +585,7 @@ if (!(status & RH_PS_CCS)) return -ENODEV; - /* khubd will finish the reset later */ + /* hub_wq will finish the reset later */ ohci_writel(ohci, RH_PS_PRS, &ohci->regs->roothub.portstatus [port]); return 0; } @@ -607,7 +610,7 @@ /* wrap-aware logic morphed from */ #define tick_before(t1,t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0) -/* called from some task, normally khubd */ +/* called from some task, normally hub_wq */ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) { __hc32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; @@ -664,7 +667,7 @@ return 0; } -static int ohci_hub_control ( +int ohci_hub_control( struct usb_hcd *hcd, u16 typeReq, u16 wValue, @@ -743,10 +746,8 @@ temp = roothub_portstatus (ohci, wIndex); put_unaligned_le32(temp, buf); -#ifndef OHCI_VERBOSE_DEBUG - if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ -#endif - dbg_port (ohci, "GetStatus", wIndex, temp); + if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ + dbg_port(ohci, "GetStatus", wIndex, temp); break; case SetHubFeature: switch (wValue) { @@ -792,4 +793,4 @@ } return retval; } - +EXPORT_SYMBOL_GPL(ohci_hub_control);