clarifying the use of try_module_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have read the FAQ at
http://people.redhat.com/zaitcev/notes/rusty_mod_faq.news and looked at a
lot of drivers in the kernel but I am still confused about the use of
try_module_get() and exported symbols.

As I understand it try_module_get() should be used in place of the
depreciated MOD_COUNTS so if I have a module moduleA. I use
try_module_get(THIS_MODULE) in the open function and module_put(THIS_MODULE)
in the release funtion.

What do I need to do in the following scenario:

moduleA has a function foo() which I export with EXPORT_SYMBOL(foo). I now
want to call that function foo() from a second module moduleB.

Do I have to wrap the call with try_module_get(moduleA) for example

moduleB_calling_foo_in_moduleA
{
  if (try_module_get(moduleA))
	foo();

}

If so how do I get a reference to moduleA from within moduleB?




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux