Skip to content

Commit 8926bfa

Browse files
David Brownellgregkh
authored andcommitted
[PATCH] USB: ehci fixups
Rename the EHCI "reset" routine so it better matches what it does (setup); and move the one-time data structure setup earlier, before doing anything that implicitly relies on it having been completed already. From: David Brownell <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8de9840 commit 8926bfa

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/usb/host/ehci-pci.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
121121
return 0;
122122
}
123123

124-
/* called by khubd or root hub (re)init threads; leaves HC in halt state */
125-
static int ehci_pci_reset(struct usb_hcd *hcd)
124+
/* called during probe() after chip reset completes */
125+
static int ehci_pci_setup(struct usb_hcd *hcd)
126126
{
127127
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
128128
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
@@ -141,6 +141,11 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
141141
if (retval)
142142
return retval;
143143

144+
/* data structure init */
145+
retval = ehci_init(hcd);
146+
if (retval)
147+
return retval;
148+
144149
/* NOTE: only the parts below this line are PCI-specific */
145150

146151
switch (pdev->vendor) {
@@ -154,7 +159,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
154159
/* AMD8111 EHCI doesn't work, according to AMD errata */
155160
if (pdev->device == 0x7463) {
156161
ehci_info(ehci, "ignoring AMD8111 (errata)\n");
157-
return -EIO;
162+
retval = -EIO;
163+
goto done;
158164
}
159165
break;
160166
case PCI_VENDOR_ID_NVIDIA:
@@ -207,9 +213,8 @@ static int ehci_pci_reset(struct usb_hcd *hcd)
207213
/* REVISIT: per-port wake capability (PCI 0x62) currently unused */
208214

209215
retval = ehci_pci_reinit(ehci, pdev);
210-
211-
/* finish init */
212-
return ehci_init(hcd);
216+
done:
217+
return retval;
213218
}
214219

215220
/*-------------------------------------------------------------------------*/
@@ -344,7 +349,7 @@ static const struct hc_driver ehci_pci_hc_driver = {
344349
/*
345350
* basic lifecycle operations
346351
*/
347-
.reset = ehci_pci_reset,
352+
.reset = ehci_pci_setup,
348353
.start = ehci_run,
349354
#ifdef CONFIG_PM
350355
.suspend = ehci_pci_suspend,

0 commit comments

Comments
 (0)