7.6 Unregistering the PCMCIA Event Callback Routine
The following code shows how the
el_unattach( )
routine unregisters
the PCMCIA event callback routine:
if (sc->ispcmcia)
1
pcmcia_unregister_event_callback(sc->cinfop->socket_vnum,
CARD_REMOVAL_EVENT,
(caddr_t)el_card_remove);
1
For PCMCIA versions of the card, directs the bus code not to return
notification if the card has been removed.
7.7 Stopping the Polling Process
The following code shows how the
el_unattach( )
routine stops the polling
process:
s = splimp();
simple_lock(&sc->el_softc_lock);
if (el_polling && sc->polling_flag) {
1
untimeout((void *)el_intr, (void *)ifp->if_unit);
2
sc->polling_flag = 0;
3
}
simple_unlock(&sc->el_softc_lock);
splx(s);
1
Stops the polling process if polling had originally been requested by
the user.
2
Removes the scheduled event from the system’s timer queue.
3
Sets the
polling_flag
member to 0 (false) to indicate that polling
has stopped.
7.8 Unregistering the Shutdown Routine
The following code shows how the
el_unattach( )
routine unregisters
the shutdown routine:
drvr_register_shutdown(el_shutdown, (void*)sc, DRVR_UNREGISTER);
1
1
Unregisters the shutdown routine, which was registered during the
probe
operation.
7.9 Terminating the Simple Lock
The following code shows how the
el_unattach( )
routine terminates the
softc
lock:
simple_lock_terminate(&sc->el_softc_lock);
1
1
Frees up the
softc
lock.
7–4 Implementing the unattach Routine