<div dir="ltr">Thanks, Ido.<br><div><pre> I think if hwspinlock mudule probe register have not return 0 Or <br>executed over, we can assume that system can not do acquire the <br></pre><pre>lock, that must be later than hardware module register..<br>
<br></pre><pre> For example, if there have 32 locks, that using the same bank, <br></pre><pre>if register lock 31 failed, then omap hwlock module will release <br>bank struct like this:<br><br>reg_fail:<br> pm_runtime_disable(&pdev->dev);<br>
kfree(bank);<br>iounmap_base:<br> iounmap(io_base);<br> return ret;<br>}<br><br></pre><pre>so, for this time, if the spinlocks might already be acquired, that<br></pre><pre>lock will can not find the bank pointer...<br>
<br><br></pre><br>/**<br> * hwspin_lock_register() - register a new hw spinlock device<br> * @bank: the hwspinlock device, which usually provides numerous hw locks<br>@@ -345,9 +392,18 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,<br>
spin_lock_init(&hwlock->lock);<br> hwlock->bank = bank;<br> <br>+<br> ret = hwspin_lock_register_single(hwlock, base_id + i);<br>- if (ret)<br>+ if (ret) {<br>
goto reg_failed;<br>+ } else {<br>+ ret = hwspin_lock_tests(ops, hwlock);<br>+ if (ret) {<br>+ pr_err("hwspinlock tests failed on lock %d\n",<br>
+ base_id + i);<br>+ goto reg_failed;<br>+ }<br>+ }<br> }<br> <br> return 0;<br><br><br></div><div>Steve.<br></div>
<div><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/30 Ido Yariv <span dir="ltr"><<a href="mailto:ido@wizery.com" target="_blank">ido@wizery.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Steve,<br>
<div class="im"><br>
On Sun, Dec 30, 2012 at 10:13:08PM +0800, steve.zhan wrote:<br>
> Hi,<br>
</div><div class="im">> Acked-by: Steve zhan <a href="mailto:zhanzhenbo@gmail.com">zhanzhenbo@gmail.com</a><br>
> <br>
> "I'd rather not test the spinlocks after they are registering as they<br>
> might already be in use by then."<br>
><br>
> Why? I think user must use it after hwspin_lock_register have retured<br>
> sucess.<br>
<br>
</div>Once the spinlocks are registered anyone can request and acquire these.<br>
The tests could then interfere with any users of the hwspinlock layer,<br>
or simply fail (because the spinlocks might already be acquired).<br>
<br>
Thanks,<br>
Ido.<br>
</blockquote></div><br><br clear="all"><br>-- <br>Steve Zhan
</div>