Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2015 22:27:15 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283637 - head/sys/dev/bwi
Message-ID:  <201505272227.t4RMRFvn075510@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed May 27 22:27:15 2015
New Revision: 283637
URL: https://svnweb.freebsd.org/changeset/base/283637

Log:
  Setup the interrupt handler after bwi_attach(). If IRQ is shared, interrupt
  may come during bwi_attach().

Modified:
  head/sys/dev/bwi/if_bwi_pci.c

Modified: head/sys/dev/bwi/if_bwi_pci.c
==============================================================================
--- head/sys/dev/bwi/if_bwi_pci.c	Wed May 27 22:25:49 2015	(r283636)
+++ head/sys/dev/bwi/if_bwi_pci.c	Wed May 27 22:27:15 2015	(r283637)
@@ -161,12 +161,6 @@ bwi_pci_attach(device_t dev)
 		device_printf(dev, "could not map interrupt\n");
 		goto bad1;
 	}
-	if (bus_setup_intr(dev, sc->sc_irq_res,
-			   INTR_TYPE_NET | INTR_MPSAFE,
-			   NULL, bwi_intr, sc, &sc->sc_irq_handle)) {
-		device_printf(dev, "could not establish interrupt\n");
-		goto bad2;
-	}
 
 	/* Get more PCI information */
 	sc->sc_pci_did = pci_get_device(dev);
@@ -174,11 +168,17 @@ bwi_pci_attach(device_t dev)
 	sc->sc_pci_subvid = pci_get_subvendor(dev);
 	sc->sc_pci_subdid = pci_get_subdevice(dev);
 
-	error = bwi_attach(sc);
-	if (error == 0)					/* success */
-		return 0;
+	if ((error = bwi_attach(sc)) != 0)
+		goto bad2;
+
+	if (bus_setup_intr(dev, sc->sc_irq_res,
+			   INTR_TYPE_NET | INTR_MPSAFE,
+			   NULL, bwi_intr, sc, &sc->sc_irq_handle)) {
+		device_printf(dev, "could not establish interrupt\n");
+		goto bad2;
+	}
+	return (0);
 
-	bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle);
 bad2:
 	bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
 bad1:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505272227.t4RMRFvn075510>