From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933905AbcIOHv6 (ORCPT ); Thu, 15 Sep 2016 03:51:58 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51192 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754738AbcIOHv4 (ORCPT ); Thu, 15 Sep 2016 03:51:56 -0400 Date: Thu, 15 Sep 2016 09:51:50 +0200 From: Peter Zijlstra To: Linus Walleij Cc: Bartosz Golaszewski , Alexandre Courbot , Ingo Molnar , LKML , linux-gpio Subject: Re: lockdep: incorrect deadlock warning with two GPIO expanders Message-ID: <20160915075150.GO5008@twins.programming.kicks-ass.net> References: <20160912120938.GR10153@twins.programming.kicks-ass.net> <20160912153356.GD10121@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 13, 2016 at 02:29:24PM +0200, Linus Walleij wrote: > On Mon, Sep 12, 2016 at 5:33 PM, Peter Zijlstra wrote: > > On Mon, Sep 12, 2016 at 05:16:14PM +0200, Bartosz Golaszewski wrote: > > >> AFAIK there is no clean way to tell that a GPIO is used by an I2C > >> multiplexer at probe time. Linus, Alexandre could you confirm? > > Nominally, the GPIO descriptors are just abstract resources such > as regulators or clocks, they can be used for a lot but just like > a clock, regulator, dma channel etc does not know who is using > it and for what, it does not know this, no. > > > You cannot inspect the device tree while probing? > > Of course it *can* but we would end up encoding a special > case every time something like this happens, tied to just > device tree, then another bolt-on for ACPI etc. > > I have a hard time following the problem really, I'm > afraid I'm simply just not smart enough :( Why would this be DT or ACPI specific? Linux itself has a tree/graph of all busses and devices right? That's what all this drivers/base/ stuff is on about. So can't you walk up that and see if you encounter the exact same driver again? Something like: for (nr = 0, parent = dev->parent; parent; parent = parent->parent) { if (parent->device_driver == &pca953x_driver.driver) nr++; } Again, I have no clue how any of this works, but that seems like something that ought to work.