From: Sepherosa Ziehau Date: Tue, 20 Sep 2005 09:06:58 +0000 (+0000) Subject: Setup intr in the last step of uhci_pci_attach(). X-Git-Tag: v2.0.1~5927 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/aa0bb337d9d7f3fbd394fca7009ad94d010cd4ba?hp=fc86679c62a70df4c349345e6d7581215dde53e6 Setup intr in the last step of uhci_pci_attach(). This can (reliably) prevent uhci_intr() from being called before uhci_init() and child devices's attachment. Reviewed-and-Approved-by: asmodai # This shuts up "livelock!" complaining (only during system starting up) # on my test box, to which a USB ethernet card is attached. --- diff --git a/sys/bus/usb/uhci_pci.c b/sys/bus/usb/uhci_pci.c index d5a5522c92..622df3399c 100644 --- a/sys/bus/usb/uhci_pci.c +++ b/sys/bus/usb/uhci_pci.c @@ -35,7 +35,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/uhci_pci.c,v 1.51 2003/11/28 05:28:29 imp Exp $ - * $DragonFly: src/sys/bus/usb/uhci_pci.c,v 1.5 2005/05/24 20:58:54 dillon Exp $ + * $DragonFly: src/sys/bus/usb/uhci_pci.c,v 1.6 2005/09/20 09:06:58 sephe Exp $ */ /* Universal Host Controller Interface @@ -326,14 +326,6 @@ uhci_pci_attach(device_t self) break; } - err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO, - (driver_intr_t *) uhci_intr, sc, &sc->ih, NULL); - if (err) { - device_printf(self, "Could not setup irq, %d\n", err); - sc->ih = NULL; - uhci_pci_detach(self); - return ENXIO; - } /* * Set the PIRQD enable bit and switch off all the others. We don't * want legacy support to interfere with us XXX Does this also mean @@ -356,6 +348,16 @@ uhci_pci_attach(device_t self) uhci_pci_detach(self); return EIO; } + + err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO, + (driver_intr_t *) uhci_intr, sc, &sc->ih, NULL); + if (err) { + device_printf(self, "Could not setup irq, %d\n", err); + sc->ih = NULL; + uhci_pci_detach(self); + return ENXIO; + } + return 0; /* success */ }