summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-08-01 21:33:07 +0000
committerjhb <jhb@FreeBSD.org>2008-08-01 21:33:07 +0000
commit635c22c54199c39bc88eebfb4b942bf68245e69f (patch)
tree7ab93f30c729d20c7d915ec5855d4742c3fa41f7 /sys/dev
parentfb79f73c28253a3656f0acb17ecf928ba367b468 (diff)
downloadFreeBSD-src-635c22c54199c39bc88eebfb4b942bf68245e69f.zip
FreeBSD-src-635c22c54199c39bc88eebfb4b942bf68245e69f.tar.gz
Use the new bus device_shutdown hook for performing the shutdown action
on the ee16 parts rather than explicitly registering an event handler that wasn't being torn down on detach.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ie/if_ie.c12
-rw-r--r--sys/dev/ie/if_ie_isa.c15
-rw-r--r--sys/dev/ie/if_ievar.h1
3 files changed, 19 insertions, 9 deletions
diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c
index eee947f..e3ba1d2 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -173,7 +173,6 @@ static void ee16_eeprom_outbits (struct ie_softc *, int, int);
static void ee16_eeprom_clock (struct ie_softc *, int);
static u_short ee16_read_eeprom (struct ie_softc *, int);
static int ee16_eeprom_inbits (struct ie_softc *);
-static void ee16_shutdown (void *, int);
static __inline void
ie_ack (struct ie_softc *, u_int);
@@ -245,10 +244,9 @@ static const char *ie_hardware_names[] = {
#define MK_24(base, ptr) ((caddr_t)((uintptr_t)ptr - (uintptr_t)base))
#define MK_16(base, ptr) ((u_short)(uintptr_t)MK_24(base, ptr))
-static void
-ee16_shutdown(void *xsc, int howto)
+void
+ee16_shutdown(struct ie_softc *sc)
{
- struct ie_softc *sc = (struct ie_softc *)xsc;
ee16_reset_586(sc);
outb(PORT(sc) + IEE16_ECTRL, IEE16_RESET_ASIC);
@@ -322,10 +320,6 @@ ie_attach(device_t dev)
ifp->if_init = ieinit;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
- if (sc->hard_type == IE_EE16)
- EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
- sc, SHUTDOWN_PRI_DEFAULT);
-
ether_ifattach(ifp, sc->enaddr);
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
@@ -1802,7 +1796,7 @@ ie_detach (device_t dev)
IE_LOCK(sc);
if (sc->hard_type == IE_EE16)
- ee16_shutdown(sc, 0);
+ ee16_shutdown(sc);
ie_stop(sc);
IE_UNLOCK(sc);
diff --git a/sys/dev/ie/if_ie_isa.c b/sys/dev/ie/if_ie_isa.c
index 5b0ba88..7ccddd2 100644
--- a/sys/dev/ie/if_ie_isa.c
+++ b/sys/dev/ie/if_ie_isa.c
@@ -78,6 +78,7 @@ static int ie_3C507_port_check (u_int32_t);
static void ie_isa_ee16_identify (driver_t *, device_t);
static int ie_isa_ee16_probe (device_t);
static int ie_isa_ee16_attach (device_t);
+static int ie_isa_ee16_shutdown (device_t);
static int ie_ee16_port_check (u_int32_t port);
static u_int16_t ie_ee16_hw_read_eeprom (u_int32_t port, int loc);
@@ -560,6 +561,19 @@ bad:
return (error);
}
+static int
+ie_isa_ee16_shutdown(device_t dev)
+{
+ struct ie_softc * sc;
+
+ sc = device_get_softc(dev);
+ IE_LOCK(sc);
+ ee16_shutdown(sc);
+ IE_UNLOCK(sc);
+
+ return (0);
+}
+
/*
* If an EE16 is present, return 0
* else, return 1.
@@ -816,6 +830,7 @@ static device_method_t ie_isa_ee16_methods[] = {
DEVMETHOD(device_identify, ie_isa_ee16_identify),
DEVMETHOD(device_probe, ie_isa_ee16_probe),
DEVMETHOD(device_attach, ie_isa_ee16_attach),
+ DEVMETHOD(device_shutdown, ie_isa_ee16_shutdown),
DEVMETHOD(device_detach, ie_detach),
{ 0, 0 }
};
diff --git a/sys/dev/ie/if_ievar.h b/sys/dev/ie/if_ievar.h
index e588d80..35fb836 100644
--- a/sys/dev/ie/if_ievar.h
+++ b/sys/dev/ie/if_ievar.h
@@ -91,6 +91,7 @@ void sl_chan_attn (struct ie_softc *);
void ee16_reset_586 (struct ie_softc *);
void ee16_chan_attn (struct ie_softc *);
+void ee16_shutdown (struct ie_softc *);
void sl_read_ether (struct ie_softc *, unsigned char *);
int check_ie_present (struct ie_softc *);
OpenPOWER on IntegriCloud