linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: linux-gpio@vger.kernel.org,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Alexandre Courbot <gnurou@gmail.com>
Subject: Re: [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed
Date: Thu, 6 Aug 2015 15:40:32 +0200	[thread overview]
Message-ID: <CAAObsKBk54ZAhGVmpONeBtX1AJv0woq7sp3cCGZ1FeDtTst_DA@mail.gmail.com> (raw)
In-Reply-To: <1436862596-27730-3-git-send-email-tomeu.vizoso@collabora.com>

On 14 July 2015 at 10:29, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> If the gpio DT node has the gpio-ranges property, the range will be
> added by the gpio core and doesn't need to be added by the pinctrl
> driver.
>
> By having the gpio-ranges property, we have an explicit dependency from
> the gpio node to the pinctrl node and we can stop using the deprecated
> pinctrl_add_gpio_range() function.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Acked-by: Stephen Warren <swarren@nvidia.com>

Hi Linus,

do you mind if this goes through the Tegra tree? It would be best if
it went together with 3/3 ("ARM: tegra: Add gpio-ranges property"), to
avoid duplicated GPIO ranges.

Thanks,

Tomeu

> ---
>
> Changes in v2: None
>
>  drivers/pinctrl/pinctrl-tegra.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
> index 0f982b829be1..0fd7fd2b0f72 100644
> --- a/drivers/pinctrl/pinctrl-tegra.c
> +++ b/drivers/pinctrl/pinctrl-tegra.c
> @@ -624,6 +624,22 @@ static struct pinctrl_desc tegra_pinctrl_desc = {
>         .owner = THIS_MODULE,
>  };
>
> +static bool gpio_node_has_range(void)
> +{
> +       struct device_node *np;
> +       bool has_prop = false;
> +
> +       np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio");
> +       if (!np)
> +               return has_prop;
> +
> +       has_prop = of_find_property(np, "gpio-ranges", NULL);
> +
> +       of_node_put(np);
> +
> +       return has_prop;
> +}
> +
>  int tegra_pinctrl_probe(struct platform_device *pdev,
>                         const struct tegra_pinctrl_soc_data *soc_data)
>  {
> @@ -708,7 +724,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
>                 return PTR_ERR(pmx->pctl);
>         }
>
> -       pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
> +       if (!gpio_node_has_range())
> +               pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
>
>         platform_set_drvdata(pdev, pmx);
>
> --
> 2.4.3
>

  reply	other threads:[~2015-08-06 13:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  8:29 [PATCH v2 0/3] Have Tegra's GPIO chip depend explicitly on the pinctrl device Tomeu Vizoso
2015-07-14  8:29 ` [PATCH v2 1/3] gpio: defer probe if pinctrl cannot be found Tomeu Vizoso
2015-07-24  9:15   ` Tomeu Vizoso
2015-07-28 10:23   ` Linus Walleij
2015-07-14  8:29 ` [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed Tomeu Vizoso
2015-08-06 13:40   ` Tomeu Vizoso [this message]
2015-08-13 12:55     ` Linus Walleij
2015-07-14  8:29 ` [PATCH v2 3/3] ARM: tegra: Add gpio-ranges property Tomeu Vizoso
2015-08-13 14:33 ` [PATCH v2 0/3] Have Tegra's GPIO chip depend explicitly on the pinctrl device Thierry Reding

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=CAAObsKBk54ZAhGVmpONeBtX1AJv0woq7sp3cCGZ1FeDtTst_DA@mail.gmail.com \
    --to=tomeu.vizoso@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).