Re: what is the use of --- try_module_get & module_put

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

 



Hi,


Is that mean instead of locking the module with a global variable like

in status = 0;
open()
{
	if(status) return -EBUSY;

	status++;
	...........
	some codes
	........

}

release()
{
	status--;
......some codes......

}


can i replace the if(status) return -EBUSY; status++; 

with 	try_module_get(THIS_MODULE);

and 	status--;   with   module_put(THIS_MODULE);



. am i correct. please correct me if my understanding was wrong.


-  
Best Regards,
Mohamed Thalib .H



On Fri, 2008-06-13 at 08:26 +0300, Daniel Baluta wrote:
> On Fri, Jun 13, 2008 at 7:19 AM, Mohamed Thalib .H
> <h.mohamedthalib@xxxxxxxxxxxxx> wrote:
> > Hi ,,
> >
> > can any one please help me in understanding the folowing function.
> >
> >
> > try_module_get(THIS_MODULE)
> > module_put(THIS_MODULE)
> >
> > -
> > Best Regards,
> > Mohamed Thalib .H
> >
> > --
> > To unsubscribe from this list: send an email with
> > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> > Please read the FAQ at http://kernelnewbies.org/FAQ
> >
> >
> 
> http://www.aoc.nrao.edu/~tjuerges/ALMA/Kernel/kernel-hacking/ch06s13.html
> 
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
> 

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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