Why device driver unload can fail in Solaris?

This requires basic understanding of some driver development terminology like detach, dev_ops, _fini, mod_remove etc. During driver unload, __fini routine is called. This routine prepares the driver (i.e., the Kernel module) for unloading. If the module determines that it can be unloaded, then __fini routine returns the values from mod_remove. The detach routine uninitializes the instances of the device. This is to be done prior to completing unload.The dev_ops is a structure used to specify device autoconfiguration entry points in the driver. Under certain conditions on the Solaris OS, a device driver cannot be unloaded. What are those conditions?
  • If a driver has no detach routine (nodev is specified in the driver's dev_ops(9S) for its detach routine).
  • If EBUSY is returned from the driver's _fini() routine.
  • If the driver has a positive number of references to it.
  • If the driver has a bus_ops structure specified in its dev_ops structure, and it has children attached to it (therefore it is a nexus driver).
  • If the driver has no dev_ops at all!
Source: http://developers.sun.com/solaris/developer/support/driver/faqs.html#QA3.28

Stumble
Delicious
Technorati
Twitter
Facebook

Bookmark and Share
Your Ad Here

0 comments

Post a Comment