s
variable. This value represents the CPU priority level that existed
before the call to
splimp( )
.
2
Calls the
simple_lock( )
routine to assert a lock with exclusive
access for the resource that is associated with the
el_softc_lock
data structure. This means that no other kernel thread can gain access
to the locked resource until you call
simple_unlock( )
to release it.
Because simple locks are spin locks,
simple_lock( )
does not return
until the lock has been obtained.
3
Stops the device and puts it in a reset state.
4
Calls the
simple_unlock( )
routine to release the simple lock.
5
Calls the
splx( )
routine to reset the CPU priority to the level that is
stored in the
s
variable.
7.4 Disabling the Interrupt Handler
The following code shows how the
el_unattach( )
routine disables and
deletes the interrupt handler:
if (sc->hid) {
1
handler_disable(sc->hid);
handler_del(sc->hid);
sc->hid = NULL;
}
1
Disables and deletes the interrupt handler. The argument that is
supplied to each function is the handler ID that was returned by
handler_add
in the
el_probe( )
routine.
7.5 Terminating the Autosense Kernel Thread
The following code shows how the
el_unattach( )
routine terminates the
autosense kernel thread:
if (sc->autosense_thread) {
1
thread_force_terminate(sc->autosense_thread);
sc->autosense_thread = NULL;
}
1
Terminates the autosense kernel thread.
Implementing the unattach Routine 7–3