Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588486

Re: [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Tomasz Figa <tomasz.figa@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range
Date Mon, 27 Feb 2017 03:20:01 +0100
Message-ID <tfj4R-79v-3@gated-at.bofh.it> (permalink)
References <te5nk-4nQ-39@gated-at.bofh.it> <te5Qm-4zQ-33@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZF9SJLgicrWOwUGoCCXpaXIdTuBl/oUS7wV5gQ3ETu8=; b=OyhC0vpcEg74eTNuLt0YwqADIexssnEsfHB/V5clJ4lJsdr0nnJ5CCSuZERvEM46+7 YoppXcS0p8x/xyMbi0hDg/97TSRNZndBCpW13JqS/fouEo7B2BBSIJJhu7URF+sUwLiQ FRra8LBP/uA7fH3zdAjPJa4V0NjDxGOUZ6klDmoq/i9ldQFvJ8jrREI6iqc68s1JyPpc DJN64Qzae9n1K9joF8IR65LTDwHDUNl/GCHqNsFwBa27BNkfIzbl85z4eHB7sqQu1fi4 4itK+McwSTaPmCspZFkv7fuY8XSTdHOmcdKmumB1ulTS8KRTgFvnRw55FgbapqpXtQja Yvnw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZF9SJLgicrWOwUGoCCXpaXIdTuBl/oUS7wV5gQ3ETu8=; b=GKOgE6S7wC7p0jVJ2ksG4QJqxStpz+FRCyg6gWqT8030GDk/91TAsOuhOHYBjkKhlp XR2uP/TxWwhzUgJdynDnso7UHeitaTUlezhUkz1m8Kl717DnlSuQrAFWaab216/fUnRD U/hwCXeukWdb9cUukp7sLXUTP0QxHvb00g5aQe48Ja4XWk6lk3wxgoSrPNORgDtcydpc 9QxCGJMotNSyWrNri/qUmldLM3DtvMX2NZDcTNRcE4s4W/IIOuAg3nAJlepDQoe3zD4y YDVtvJ0RcJO8VlyjQQi0MAXhE/GUx4t4n4eHV+5sfRWEIC0uxO+Xbl/FkwaUGOKy97HL 7Ytw==
X-Gm-Message-State AMke39mlKDoAdhtGv63oa6/c8gxEbfUA9/tM9oTLAAQTkK2dvvTcXFnfotfixqc+nZ7LnZMJxvMFqZGG6NJo/g==
X-Received by 10.202.183.139 with SMTP id h133mr3282472oif.183.1488161640341; Sun, 26 Feb 2017 18:14:00 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 44
Organization linux.* mail to news gateway
X-Original-Cc "linus.walleij@linaro.org" <linus.walleij@linaro.org>, Krzysztof Kozlowski <krzk@kernel.org>, Sylwester Nawrocki <s.nawrocki@samsung.com>, "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, "linux-samsung-soc@vger.kernel.org" <linux-samsung-soc@vger.kernel.org>, linux-kernel <linux-kernel@vger.kernel.org>, patches@opensource.wolfsonmicro.com
X-Original-Date Mon, 27 Feb 2017 11:13:59 +0900
X-Original-Message-ID <CA+Ln22FJ=Kg_HmfjhDst4fNeUoA8jh=QVsF-rUVeXgPrzunJ+w@mail.gmail.com>
X-Original-References <20170223172313.GF2742@localhost.localdomain> <1487872490-27643-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1588486

Show key headers only | View raw


Hi Charles,

2017-02-24 2:54 GMT+09:00 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
> As the pinctrl is now added before the GPIOs are registered we need to
> manually calculate what the GPIO base will be, otherwise the base for
> each gpio_range will be set to zero. Fortunately the driver
> already assigns a GPIO base, in samsung_gpiolib_register, and uses the
> same calculation it does for the pin_base. Meaning the two will always
> be the same and allowing us to reuse the pinbase and avoid the issue.

Please see my comment inline.

>
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>
> Ok I might have spoken to soon there looks like there is a simple
> way to fix this up, at least in this case. It would be much more
> of an issue if the driver allocated its GPIO base dynamically.
>
> Thanks,
> Charles
>
>  drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index ddc8d6b..864d8b4d 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -882,7 +882,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
>                 pin_bank->grange.id = bank;
>                 pin_bank->grange.pin_base = drvdata->pin_base
>                                                 + pin_bank->pin_base;
> -               pin_bank->grange.base = pin_bank->gpio_chip.base;
> +               pin_bank->grange.base = pin_bank->grange.pin_base;

If we are not reading the base from the GPIO bank anymore, maybe it
could make sense to actually make samsung_gpiolib_register() use
bank->grange.base as gc->base? This way we would avoid explicitly
numbering two times.

Best regards,
Tomasz

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/4] pinctrl: Fix trivial spelling typo in a comment Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-16 14:30 +0100
  [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-16 14:30 +0100
    Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of  gpiochip_add_data Krzysztof Kozlowski <krzk@kernel.org> - 2017-02-17 14:40 +0100
      Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of  gpiochip_add_data Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-17 15:00 +0100
  [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-16 14:30 +0100
    Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO Linus Walleij <linus.walleij@linaro.org> - 2017-02-22 15:40 +0100
      Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-23 18:30 +0100
        [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-23 19:00 +0100
          Re: [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range Tomasz Figa <tomasz.figa@gmail.com> - 2017-02-27 03:20 +0100
            Re: [PATCH] pinctrl: samsung: Calculate GPIO base for  pinctrl_add_gpio_range Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-28 10:10 +0100
              [PATCH v2] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-02-28 18:30 +0100

csiph-web