We want to have use count in the dev_open(), dev_close() functions. Just like in Linux, in open_dev() function we counld have
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
MOD_INC_USE_COUNT;
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
try_module_get(THIS_MODULE); /* increment the usage counter */
#endif
to increment the use count. In close_dev(), we could decrement the use count.
So, when the device driver is unloaded, we would be able to know if there is any other application processes is still using the driver.
Is there anybody having any clues?
Thanks a lot,
Yong Rao