Writing Device Drivers

Handling Resource Allocation Failures

The resource-allocation routines provide the driver with several options when handling allocation failures. The waitfp argument indicates whether the allocation routines will block, return immediately, or schedule a callback, as shown in Table 7-1.

Table 7-1 Resource Allocation Handling


Indicated Action 


Driver does not need to wait for resources to become available. 


Driver is willing to wait indefinitely for resources to 

become available. 

Other values 

The address of a function to be called when resources 

are likely to be available.