* [patch] i2c: fix virtual i2c adapter lockdep warning
@ 2008-08-04 17:50 David Rientjes
[not found] ` <alpine.DEB.1.10.0808032024130.2365-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2008-08-04 17:50 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA
bus_lock for both the virtual adapter and its parent have the same lock
class. Since both are taken in i2c_virt_master_xfer() and
i2c_virt_smbus_xfer(), lockdep needs an annotation that the nesting is
safe.
Signed-off-by: David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
---
drivers/i2c/i2c-virt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-virt.c b/drivers/i2c/i2c-virt.c
--- a/drivers/i2c/i2c-virt.c
+++ b/drivers/i2c/i2c-virt.c
@@ -53,7 +53,7 @@ static int i2c_virt_master_xfer(struct i2c_adapter *adap,
* the transfer.
*/
- mutex_lock(&parent->bus_lock);
+ mutex_lock_nested(&parent->bus_lock, SINGLE_DEPTH_NESTING);
ret = priv->select(parent, priv->client, priv->id);
if (ret >= 0)
@@ -79,7 +79,7 @@ static int i2c_virt_smbus_xfer(struct i2c_adapter *adap,
* the transfer.
*/
- mutex_lock(&parent->bus_lock);
+ mutex_lock_nested(&parent->bus_lock, SINGLE_DEPTH_NESTING);
ret = priv->select(parent, priv->client, priv->id);
if (ret == 0)
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] i2c: fix virtual i2c adapter lockdep warning
[not found] ` <alpine.DEB.1.10.0808032024130.2365-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
@ 2008-08-14 11:42 ` Rodolfo Giometti
2008-08-14 19:46 ` David Rientjes
0 siblings, 1 reply; 3+ messages in thread
From: Rodolfo Giometti @ 2008-08-14 11:42 UTC (permalink / raw)
To: David Rientjes; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA
On Mon, Aug 04, 2008 at 10:50:42AM -0700, David Rientjes wrote:
> bus_lock for both the virtual adapter and its parent have the same lock
> class. Since both are taken in i2c_virt_master_xfer() and
> i2c_virt_smbus_xfer(), lockdep needs an annotation that the nesting is
> safe.
Thanks! This nested lock can be used also to remove to nolock
functions into i2c-core.c?
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org
Linux Device Driver giometti-k2GhghHVRtY@public.gmane.org
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] i2c: fix virtual i2c adapter lockdep warning
2008-08-14 11:42 ` Rodolfo Giometti
@ 2008-08-14 19:46 ` David Rientjes
0 siblings, 0 replies; 3+ messages in thread
From: David Rientjes @ 2008-08-14 19:46 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA
On Thu, 14 Aug 2008, Rodolfo Giometti wrote:
> Thanks! This nested lock can be used also to remove to nolock
> functions into i2c-core.c?
>
I haven't looked at i2c-core.c specifically, but you can nest to
SINGLE_DEPTH_NESTING anytime you are sure that two mutexes of the same
lock class are taken inside each other and its impossible that they are
actually the exact same lock.
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-14 19:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-04 17:50 [patch] i2c: fix virtual i2c adapter lockdep warning David Rientjes
[not found] ` <alpine.DEB.1.10.0808032024130.2365-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2008-08-14 11:42 ` Rodolfo Giometti
2008-08-14 19:46 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox