This routine returns an opaque
ihandler_id_t
key, which is a
unique number that identifies the interrupt handler to be acted
on by subsequent calls to
handler_del
,
handler_disable
, and
handler_enable
. The
hid
member of the
el_softc
data structure
stores this key.
9
If the return value from
handler_add
equals NULL, the
if_el
driver
failed to register an interrupt handler for the
if_el
device. This is a
fatal error, and the
if_el
driver will undo all previous operations and
return an error to the caller.
5.1.12 Saving the controller and softc Data Structure Pointers
The following code shows how the
el_probe( )
routine saves the
controller
and
el_softc
data structure pointers. All
probe
interfaces
perform this task.
el_softc[unit] = sc;
1
el_info[unit] = ctlr;
2
1
Saves the
el_softc
data structure pointer for this instance of the
3Com 3C5x9 device in the array of
el_softc
data structures. The unit
number is the offset to the data structure within the
el_softc
array.
2
Saves the
controller
data structure pointer for this instance of the
3Com 3C5x9 device in the array of
controller
data structures.
5.1.13 Trying to Allocate Another controller Data Structure
The following code shows how the
el_probe( )
routine attempts to allocate
another
controller
data structure. You make this call so that a driver
can support multiple devices.
if (!sc->reprobe && lan_create_controller(&el_data) != ESUCCESS) {
1
printf("el%d: WARNING: create_controller failed\n", unit);
}
1
If this is the first time that the device has been probed, calls the
lan_create_controller( )
routine to try to create a second
controller
data structure. If
lan_create_controller( )
fails,
calls the
printf( )
routine to display a message. (Routines that begin
with
lan_
reside in the
lan_common.c
source file.)
5–16 Implementing the Autoconfiguration Support Section (probe)