Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751896Ab0BITOa (ORCPT ); Tue, 9 Feb 2010 14:14:30 -0500 Received: from mail.dev.rtsoft.ru ([213.79.90.226]:41779 "HELO mail.dev.rtsoft.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751672Ab0BITO3 (ORCPT ); Tue, 9 Feb 2010 14:14:29 -0500 Date: Tue, 9 Feb 2010 22:14:27 +0300 From: Anton Vorontsov To: Grant Likely Cc: David Brownell , Benjamin Herrenschmidt , David Miller , Michal Simek , linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, microblaze-uclinux@itee.uq.edu.au Subject: Re: [PATCH 3/3] of/gpio: Introduce of_put_gpio(), add ref counting for OF GPIO chips Message-ID: <20100209191427.GA18263@oksana.dev.rtsoft.ru> Reply-To: avorontsov@ru.mvista.com References: <20100205204949.GA2575@oksana.dev.rtsoft.ru> <20100205205045.GC4178@oksana.dev.rtsoft.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1078 Lines: 37 On Tue, Feb 09, 2010 at 10:28:15AM -0700, Grant Likely wrote: [...] > Rather than having a lock at the device tree data pointer level which > mixes usage with potentially many other drivers; wouldn't it make more > sense to use a mutex at the of_gc subsystem context? I don't think so. of_gc = np->data; lock(of_gc); (or lock(devtree)) doesn't provide us what we need, i.e. it doesn't guarantee that np->data (of_gc) is still alive. And here: lock(np->data); (or lock(devtree)) of_gc = np->data; lock(of_gc); The second lock becomes useless (unless you also refcount np->data usage and can drop the devtree/np->data lock, and grab some other kind of lock, e.g. mutex, but this is silly). Thanks, -- Anton Vorontsov email: cbouatmailru@gmail.com irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/