public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* recursive locking problem
@ 2011-09-08 16:34 Antti Palosaari
  2011-09-09  7:51 ` Hans Petter Selasky
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Antti Palosaari @ 2011-09-08 16:34 UTC (permalink / raw)
  To: linux-media

I am working with AF9015 I2C-adapter lock. I need lock I2C-bus since 
there is two tuners having same I2C address on same bus, demod I2C gate 
is used to select correct tuner.

I am trapping demod .i2c_gate_ctrl() calls and locking bus according to 
that.

Is there any lock can do recursive locking but unlock frees all locks?

Like that:
gate_open
+gate_open
+gate_close
== lock is free

AFAIK mutex can do only simple lock() + unlock(). Semaphore can do 
recursive locking, like lock() + lock() + unlock() + unlock(). But how I 
can do lock() + lock() + unlock() == free.


Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-09-14 12:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-08 16:34 recursive locking problem Antti Palosaari
2011-09-09  7:51 ` Hans Petter Selasky
2011-09-09 10:45 ` David Waring
2011-09-13 20:59   ` Antti Palosaari
2011-09-13 21:34     ` Steve Kerrison
2011-09-13 21:58       ` Steven Toth
2011-09-13 22:10         ` Devin Heitmueller
2011-09-13 22:19           ` Steven Toth
2011-09-13 22:01       ` Devin Heitmueller
2011-09-09 11:46 ` Daniel Glöckner
2011-09-14  1:03   ` Antti Palosaari
2011-09-14  6:19     ` Daniel Glöckner
2011-09-14 10:45       ` Antti Palosaari
2011-09-14 12:22         ` Daniel Glöckner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox