Section: Kernel Functions (9)
MOD_INC_USE_COUNT, MOD_DEC_USE_COUNT - Support reference counting of modules
These macros support reference counting of modules during their
lifetime. Each time
is invoked, the kernel increases the number of counted references to
the module. The
decreases the reference count.
The reference count is used by the kernel to know when a module is no
longer in use by the device or application software. A
is generally placed in the open entry for a driver, and a
in the release for the driver,
to count the number of times the device has been opened, and thus
prevent the module being unloaded when in use. The device driver may
increment the use count other times, such as when memory is mapped or
the module must remain loaded for external events.
If the device driver is not compiled as a module
is not defined) then the macro reduces to no behavior.
These macros take no parameters and return no result.
Stephen Williams <email@example.com