Compaq AA-RNG2A-TE Unregistering the Pcmcia Event Callback Routine, Stopping the Polling Process

Models: AA-RNG2A-TE

1 159
Download 159 pages 42.56 Kb
Page 98
Image 98

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); sc->polling_flag = 0; 3

}

simple_unlock(&sc->el_softc_lock); splx(s);

2

1

2

3

Stops the polling process if polling had originally been requested by the user.

Removes the scheduled event from the system’s timer queue.

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–4Implementing the unattach Routine

Page 98
Image 98
Compaq AA-RNG2A-TE manual Unregistering the Pcmcia Event Callback Routine, Stopping the Polling Process