<div>read up:</div><div><br></div><a href="http://en.wikipedia.org/wiki/Sparse" target="_blank">http://en.wikipedia.org/wiki/Sparse</a><div><br></div><div>it was introduced to facilitate static source code checking, and the &quot;attribute&quot; itself is part of GCC:</div>

<div><br></div><div><a href="http://www.unixwiz.net/techtips/gnu-c-attributes.html" target="_blank">http://www.unixwiz.net/techtips/gnu-c-attributes.html</a></div><div><br>
</div><div>Reading up here:</div><div><br></div><div><a href="http://old.nabble.com/A-question-about-sparse%3A-how-to-use-__acquires()-and-__releases()-correctly---td20799721.html" target="_blank">http://old.nabble.com/A-question-about-sparse%3A-how-to-use-__acquires()-and-__releases()-correctly---td20799721.html</a></div>

<div><br></div><div><a href="http://www.gossamer-threads.com/lists/linux/kernel/680631" target="_blank">http://www.gossamer-threads.com/lists/linux/kernel/680631</a></div>
<div><br></div><div><a href="https://lkml.org/lkml/2006/8/22/325" target="_blank">https://lkml.org/lkml/2006/8/22/325</a></div><div><br></div><div>my understanding is that the annotation will help u to identify whether is lock is to be release or acquired, and if u did not do it (eg, in a if-then loop, only one part release the lock, but not the other), locks contentions problem may happened - so the parser (sparse) will immediately highlight that.   normally not releasing a lock will lead to CPU hard-hanging, or CPU-reaching 100% utilization bugs.</div>

<div><br></div><div>and if the lock can be used for both purpose, then u have to double declare it (as release + acquire type):</div><div><br></div><div><a href="http://old.nabble.com/linux-next%3A-manual-merge-of-the-percpu-tree-with-Linus&#39;-tree-td26126413.html" target="_blank">http://old.nabble.com/linux-next%3A-manual-merge-of-the-percpu-tree-with-Linus&#39;-tree-td26126413.html</a></div>

<div><br></div><div><div class="gmail_quote">On Mon, Oct 10, 2011 at 6:58 PM, venu <span dir="ltr">&lt;<a href="mailto:bvg_1@yahoo.com" target="_blank">bvg_1@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:14pt"><div>

</div><div class="MsoNormal">While going thro’ run time power management code in K39
power/runtime.c file, am seeing a function definition as given below. Any idea,
what “__releases” &amp; “__acquires” are doing in this function definition? </div>

<div class="MsoNormal"> </div>

<div class="MsoNormal">static int rpm_callback(int (*cb)(struct device *), struct
device *dev)</div>

<div class="MsoNormal"><span>                </span>__releases(&amp;dev-&gt;power.lock)
__acquires(&amp;dev-&gt;power.lock)</div>

<div class="MsoNormal">{</div>

<div class="MsoNormal"><span>                </span>int
retval;</div>

<div class="MsoNormal"><span>                </span>….</div>

<div class="MsoNormal"><span>                </span>return
retval;</div>

<div class="MsoNormal">}</div>

</div></div><br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div>