pinctrl: msm: Use dynamic GPIO numbering

Message ID 20180129005948.7714-1-bjorn.andersson@linaro.org
State New
Headers show
Series
  • pinctrl: msm: Use dynamic GPIO numbering
Related show

Commit Message

Bjorn Andersson Jan. 29, 2018, 12:59 a.m.
The base of the TLMM gpiochip should not be statically defined as 0, fix
this to not artificially restrict the existence of multiple pinctrl-msm
devices.

Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
Reported-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Feb. 7, 2018, 1:52 p.m. | #1
On Mon, Jan 29, 2018 at 1:59 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

> The base of the TLMM gpiochip should not be statically defined as 0, fix
> this to not artificially restrict the existence of multiple pinctrl-msm
> devices.
>
> Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
> Reported-by: Timur Tabi <timur@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

OK I put this in devel for v4.17, let's see if something explodes
in linux-next else we can go with this.

Otherwise we need something that conserves base 0 for singular
TLMM drivers and make it -1 for newer platforms with several
instances.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Timur Tabi Feb. 7, 2018, 2:52 p.m. | #2
On 2/7/18 7:52 AM, Linus Walleij wrote:
> Otherwise we need something that conserves base 0 for singular
> TLMM drivers and make it -1 for newer platforms with several
> instances.

     static int base = 0;

     chip->base = base;
     base = -1;
Timur Tabi Feb. 20, 2018, 4:42 p.m. | #3
On 02/07/2018 07:52 AM, Linus Walleij wrote:
> OK I put this in devel for v4.17, let's see if something explodes
> in linux-next else we can go with this.
> 
> Otherwise we need something that conserves base 0 for singular
> TLMM drivers and make it -1 for newer platforms with several
> instances.

I don't see this patch in linusw/linux-gpio.git anywhere.  Do you want 
me to submit another patch that implements this:

     static int base = 0;

     chip->base = base;
     base = -1;

This preserves existing behavior for current drivers.

Patch

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 495432f3341b..95e5c5ea40af 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -818,7 +818,7 @@  static int msm_gpio_init(struct msm_pinctrl *pctrl)
 		return -EINVAL;
 
 	chip = &pctrl->chip;
-	chip->base = 0;
+	chip->base = -1;
 	chip->ngpio = ngpio;
 	chip->label = dev_name(pctrl->dev);
 	chip->parent = pctrl->dev;