Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760515AbbBIJmQ (ORCPT ); Mon, 9 Feb 2015 04:42:16 -0500 Received: from mga01.intel.com ([192.55.52.88]:7244 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760488AbbBIJmO (ORCPT ); Mon, 9 Feb 2015 04:42:14 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,542,1418112000"; d="scan'208";a="649392088" From: "Holmberg, Hans" To: Alexandre Courbot , Tyler Hall CC: "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , Daniel Mack , Linus Walleij , "Linux Kernel Mailing List" , Howard Cochran , Robert Jarzmik Subject: RE: gpio-pxa: getting GPIOs by devicetree phandle broken Thread-Topic: gpio-pxa: getting GPIOs by devicetree phandle broken Thread-Index: AQHQQlPclOsXEvpZX0GO3t1tVIwV/Zzn2c2AgAAu7eA= Date: Mon, 9 Feb 2015 09:42:02 +0000 Message-ID: <4B6D6D87A8FB62428BE0A3E38461A1AB18D6B200@irsmsx105.ger.corp.intel.com> References: In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t199gMo8010778 Content-Length: 2906 Lines: 72 > > 1. Require child nodes in DT for each bank > > This would break DT compatibility. > > > 2. Refactor gpio-pxa to only register one gpiochip > > Sounds better, especially since this would reflect the hardware more > accurately. One DT node should translate into one GPIO chip. The problem is > that I'm afraid several other drivers are doing the same thing and thus are > now similarly broken. This sounds reasonable to me. > The following is also likely to work as a workaround, but I would not go as > far as saying this should be taken as a fix. Hans, since you wrote 7b8792b, > could we have your input on this? > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index > 08261f2b3a82..a09095531b00 100644 > --- a/drivers/gpio/gpiolib-of.c > +++ b/drivers/gpio/gpiolib-of.c > @@ -45,14 +45,16 @@ static int of_gpiochip_find_and_xlate(struct > gpio_chip *gc, void *data) > return false; > > ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); > - if (ret < 0) { > + if (ret == -EPROBE_DEFER) { > /* We've found the gpio chip, but the translation failed. > * Return true to stop looking and return the translation > * error via out_gpio > */ > gg_data->out_gpio = ERR_PTR(ret); > return true; > - } > + } else if (ret < 0) { > + return false; > + } > > gg_data->out_gpio = gpiochip_get_desc(gc, ret); > return true; The problem my patch solved was that -EPROBE_DEFER was returned regardless of lookup-error in of_get_named_gpiod_flags, not that -EPROBE_DEFER error was not passed on. The issue with multiple gpiochips per of-node could be worked around as followed I believe, comments? diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 08261f2..43984ab 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -47,11 +47,12 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data) ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); if (ret < 0) { /* We've found the gpio chip, but the translation failed. - * Return true to stop looking and return the translation - * error via out_gpio + * Store translation error in out_gpio. + * Return false to keep looking, as more than one GPIO chip + * could be registered per of-node. */ gg_data->out_gpio = ERR_PTR(ret); - return true; + return false; } gg_data->out_gpio = gpiochip_get_desc(gc, ret); -- Best regards, Hans ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?