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.
This commit is contained in:
John Baldwin 2008-08-01 21:33:07 +00:00
parent 08649f593c
commit 9b1db80125
3 changed files with 19 additions and 9 deletions

View File

@ -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);

View File

@ -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 }
};

View File

@ -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 *);