Return-path: Received: from mail-oa0-f47.google.com ([209.85.219.47]:49123 "EHLO mail-oa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756701AbaCEBnS (ORCPT ); Tue, 4 Mar 2014 20:43:18 -0500 Received: by mail-oa0-f47.google.com with SMTP id i11so389016oag.20 for ; Tue, 04 Mar 2014 17:43:17 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <530D218E.9010007@wwwdotorg.org> References: <1393330950-7283-1-git-send-email-heikki.krogerus@linux.intel.com> <1393330950-7283-4-git-send-email-heikki.krogerus@linux.intel.com> <530D218E.9010007@wwwdotorg.org> Date: Wed, 5 Mar 2014 09:43:16 +0800 Message-ID: (sfid-20140305_024342_365688_5C06C69A) Subject: Re: [PATCHv2 3/5] net: rfkill: gpio: remove gpio names From: Linus Walleij To: Stephen Warren Cc: Heikki Krogerus , Johannes Berg , "David S. Miller" , Chen-Yu Tsai , Rhyland Klein , Marc Dietrich , Arnd Bergmann , Alexandre Courbot , linux-wireless , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-tegra@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Wed, Feb 26, 2014 at 7:04 AM, Stephen Warren wrote: >> - gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0); >> + gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0); > > I think the correct fix here is to look up the GPIO by name rather than > by index, but simply hard-code the name rather than generating it with > sprintf(). Index lookups are hard to expand compatibly, but named-based > lookups scale much better. > > In other words, I rather specifically disagree with using a plain > "gpios" property in any future DT binding, but would strongly prefer > e.g. reset-gpios/shutdown-gpios or gpios/gpio-names. If I understand the situation correctly it's like ACPI does not have named GPIOs so keeping specifying this in DT GPIO bindings is counter-productive to the work of abstracting the access to GPIO handlers so that drivers need not know whether ACPI or DT is used for describing the hardware. We could do worse. Like putting the GPIOs in a differently indexed order in DT vs ACPI. I have no strong opinion really, I just see that people doing DT and ACPI HW descriptions need to cooperate if they want to share infrastructure or we have to give up that pipe dream and let each HW description method have its own unique probe()-runpath. Which would be the result in this driver if we persist on using named GPIOs. Yours, Linus Walleij