2008-05-23 07:42:45 cli() and sti() functions in linux krnel
Appalayagari Sreedhar (INDIA)
Message: 56206
Hi,
Can we use cli() for clearing theinterrupts and sti() for storing interrupts in the linux kernel.
or is there any functions which are equivalent to the above.
Thanks and Regards,Sreedhar.
QuoteReplyEditDelete
2008-05-23 08:37:11 Re: cli() and sti() functions in linux krnel
Mike Frysinger (UNITED STATES)
Message: 56209
to answer your specific question, there are local and spinlock versions which save/restore the irq flags which you should be using ... the functions can be found in interrupt.h or spinlock.h. anything marked "deprecated" (like cli/sti) certainly should not be used.
however, you really should read a book on the topic ... there are plenty of good (and some free) to be found:
http://docs.blackfin.uclinux.org/doku.php?id=references_and_pointers
people often turn off interrupts instead of using proper locking mechanisms to protect "critical" sections in their drivers. that is a path to destruction, wasted debug time, an unresponsive/crappy system, and many other terrible things. i'm not saying you're doing it for this reason, just that it is a likely scenario which you should be avoiding.