8
Calls the
kernel_thread_w_arg( )
routine to create and start a
kernel thread with timeshare scheduling. A kernel thread that is
created with timeshare scheduling means that its priority degrades if it
consumes an inordinate amount of CPU resources. Make sure that your
device driver calls
kernel_thread_w_arg( )
only for long-running
tasks and always attaches a kernel thread to the first task.
The
kernel_thread_w_arg( )
routine returns a pointer to the
thread
data structure for the newly created thread. The device driver stores
this pointer in the
autosense_thread
member of the
el_softc
data
structure.
9
If the value that
kernel_thread_w_arg( )
returns is NULL, then the
thread could not be created. At this point, the
el_probe( )
routine
must undo previous work and return a failure indication to the caller.
10
For PCMCIA versions of the card, unregisters the callback routine that
was previously registered.
11
Deallocates the
ether_driver
data structure for this device.
12
Frees up any memory that was allocated for enhanced hardware
management and unregisters this card from the hardware management
database.
13
Calls the
FREE
macro, which frees the memory that was previously
allocated for the
el_softc
data structure.
14
Returns the value 0 (zero) to indicate that the probe operation failed.
5.1.10 Handling Subsequent Probe Operations
If the device had already been probed, the
if_el
device driver reads the
EEPROM to determine whether the hardware address has changed. The
following code shows how the
el_probe( )
routine performs these tasks:
} else {
struct w3_eeprom ee_copy;
unsigned char tmp_addr[8];
struct ifreq ifr;
struct ifnet *ifp = &sc->is_if
if (multi_func_flag) {
1
bzero((caddr_t)&tuple_data, sizeof(struct tuple_data_info));
tuple_data_infop = &tuple_data;
tuple_infop = (struct tuple_info *)&tuple_data;
tuple_infop->socket = (short) card_infop->socket_vnum;
tuple_infop->attributes = 0;
tuple_infop->DesiredTuple = 0x88;
status = GetFirstTuple(tuple_infop);
if (status == SUCCESS) {
tuple_data_infop->TupleOffset = 0;
tuple_data_infop->TupleDataMax = (u_short)TUPLE_DATA_MAX;
status = GetTupleData(tuple_data_infop);
5–12 Implementing the Autoconfiguration Support Section (probe)