All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Stephen Warren <swarren@wwwdotorg.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Grant Likely <grant.likely@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Rhyland Klein <rklein@nvidia.com>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Mark Gross <mark.gross@intel.com>
Subject: Re: [PATCH 2/4] net: rfkill: gpio: remove gpio names
Date: Tue, 25 Feb 2014 10:13:35 +0100	[thread overview]
Message-ID: <CACRpkdZBvKU31EDX=6=wVLXaQDAqD6VHtaE_mGnFLr1UYQAH9g@mail.gmail.com> (raw)
In-Reply-To: <5306E599.7020605@wwwdotorg.org>

On Fri, Feb 21, 2014 at 6:35 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 02/20/2014 06:55 PM, Chen-Yu Tsai wrote:

>> That's correct. However using con_id to pass this results in different
>> behavior across DT and ACPI. A better way is to export the labeling
>> function so consumers can set meaningful labels themselves.
>
> But this code is the consumer of those GPIOs. IF the parameter to
> devm_gpiod_get_index() isn't intended to be used, why does it exist?

Kerneldoc says:

/**
 * gpiod_get_index - obtain a GPIO from a multi-index GPIO function
 * @dev:        GPIO consumer, can be NULL for system-global GPIOs
 * @con_id:     function within the GPIO consumer
 * @idx:        index of the GPIO to obtain in the consumer
 *

Basically it is just exposing the fact that of_find_gpio() and
acpi_find_gpio() both take a con_id as argument.

If we drill into this, we find that it is used to conjure the
arbitrary string before the gpios in the DT case, like:

foo-gpios = <...>;

As in tegra30-beaver.dts...

    sdhci@78000000 {
            status = "okay";
            cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
            wp-gpios = <&gpio TEGRA_GPIO(T, 3) GPIO_ACTIVE_HIGH>;
            power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>;
            bus-width = <4>;
    };

Instead of passing the GPIOs as index 0,1,2 they are named
and I do admit this has a nice "things are under control" aspect
to it.

In the ACPI case the con_id is not used for anything.

So it is basically there to satisfy the habit in some device
tree bindings to name gpio arrays instead of just passing gpios = <...>;
(The latter should be encouraged going forward.)

As DT is ABI we need to keep this forever, and driver may need to
look for foo-gpios=<> and gpios=<> alike for backward compatibility
if we'd change it, sweet isn't it? :-)

I don't quite like this, as it is adding stupid nonsens arguments for
ACPI GPIO producers (which only take an index AFAICT), but it is a
first sacrifice on the altar of trying to mask the differences between DT
and ACPI probe paths about which I have mixed feelings.

Yours,
LInus Walleij

  reply	other threads:[~2014-02-25  9:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 12:51 [PATCH 0/4] net: rfkill: gpio: clean up and a few new acpi ids Heikki Krogerus
2014-02-20 12:51 ` [PATCH 1/4] net: rfkill: gpio: remove unused and obsolete platform parameters Heikki Krogerus
2014-02-21 13:55   ` Marc Dietrich
2014-02-21 14:23     ` Heikki Krogerus
2014-02-22 22:32       ` [PATCH 1/4] net: rfkill: gpio: remove unused and obsoleteplatform parameters Marc Dietrich
2014-02-24  8:38         ` Heikki Krogerus
2014-02-24  8:42           ` [PATCH 1/4] net: rfkill: gpio: remove unused andobsoleteplatform parameters Marc Dietrich
2014-02-20 12:51 ` [PATCH 2/4] net: rfkill: gpio: remove gpio names Heikki Krogerus
2014-02-20 16:38   ` Stephen Warren
2014-02-21  1:55     ` Chen-Yu Tsai
2014-02-21  5:35       ` Stephen Warren
2014-02-21  5:35         ` Stephen Warren
2014-02-25  9:13         ` Linus Walleij [this message]
2014-02-25 17:35           ` Stephen Warren
2014-03-07  2:51             ` Linus Walleij
2014-03-07  2:51               ` Linus Walleij
2014-02-27 17:38           ` Gross, Mark
2014-02-27 17:47             ` Stephen Warren
2014-02-27 20:06               ` mark gross
2014-03-07  2:58             ` Linus Walleij
2014-02-20 12:51 ` [PATCH 3/4] net: rfkill: gpio: add ACPI ID for GPS module on Lenove Miix2 Heikki Krogerus
2014-02-20 12:51 ` [PATCH 4/4] net: rfkill: gpio: add ACPI IDs for a Broadcom bluetooth chip Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACRpkdZBvKU31EDX=6=wVLXaQDAqD6VHtaE_mGnFLr1UYQAH9g@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mark.gross@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=rklein@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.