Message ID | 1416234632-16166-1-git-send-email-geert+renesas@glider.be |
---|---|
State | Rejected |
Headers | show |
On Monday 17 November 2014 15:30:32 Geert Uytterhoeven wrote: > Use dynamic allocation of GPIOs instead of looking at the gpio%u alias > in DT. > --- > - Is this correct? Not having to care about the alias would simplify the > to-be-written DT binding documentation. > - Completely untested. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > This will obviously break any user that expects a particular gpio number, in particular board files, but I guess also user space that tries to access the gpios through sysfs. If you don't have any of those, I guess it's correct. Arnd -- 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
Hi Arnd, On Mon, Nov 17, 2014 at 3:34 PM, Arnd Bergmann <arnd@arndb.de> wrote: > On Monday 17 November 2014 15:30:32 Geert Uytterhoeven wrote: >> Use dynamic allocation of GPIOs instead of looking at the gpio%u alias >> in DT. >> --- >> - Is this correct? Not having to care about the alias would simplify the >> to-be-written DT binding documentation. >> - Completely untested. >> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> >> > > This will obviously break any user that expects a particular gpio > number, in particular board files, but I guess also user space > that tries to access the gpios through sysfs. > > If you don't have any of those, I guess it's correct. Emev2/kzm9d was the first DT-only shmobile SoC/board, so the kernel part should be OK. No idea about userspace. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- 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
On Mon, Nov 17, 2014 at 11:30 PM, Geert Uytterhoeven <geert+renesas@glider.be> wrote: > Use dynamic allocation of GPIOs instead of looking at the gpio%u alias > in DT. > --- > - Is this correct? Not having to care about the alias would simplify the > to-be-written DT binding documentation. > - Completely untested. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > drivers/gpio/gpio-em.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c > index 21d34d4d473dcefe..c3434146f605748b 100644 > --- a/drivers/gpio/gpio-em.c > +++ b/drivers/gpio/gpio-em.c > @@ -330,12 +330,7 @@ static int em_gio_probe(struct platform_device *pdev) > goto err0; > } > > - ret = of_alias_get_id(pdev->dev.of_node, "gpio"); > - if (ret < 0) { > - dev_err(&pdev->dev, "Couldn't get OF id\n"); > - goto err0; > - } > - pdata->gpio_base = ret * 32; /* 32 GPIOs per instance */ > + pdata->gpio_base = -1; User-space might break because of GPIO renumbering. Why not setting gpio_base to -1 when the property is not present (instead of triggering an error), keeping support for the property so existing boards remain safe, and marking the property as deprecated in the bindings documentation? -- 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
On Mon, Nov 17, 2014 at 3:30 PM, Geert Uytterhoeven <geert+renesas@glider.be> wrote: > Use dynamic allocation of GPIOs instead of looking at the gpio%u alias > in DT. > --- > - Is this correct? Not having to care about the alias would simplify the > to-be-written DT binding documentation. > - Completely untested. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Patch applied. 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
On Tue, Nov 18, 2014 at 4:11 AM, Alexandre Courbot <gnurou@gmail.com> wrote: > On Mon, Nov 17, 2014 at 11:30 PM, Geert Uytterhoeven > <geert+renesas@glider.be> wrote: >> - ret = of_alias_get_id(pdev->dev.of_node, "gpio"); >> - if (ret < 0) { >> - dev_err(&pdev->dev, "Couldn't get OF id\n"); >> - goto err0; >> - } >> - pdata->gpio_base = ret * 32; /* 32 GPIOs per instance */ >> + pdata->gpio_base = -1; > > User-space might break because of GPIO renumbering. Why not setting > gpio_base to -1 when the property is not present (instead of > triggering an error), keeping support for the property so existing > boards remain safe, and marking the property as deprecated in the > bindings documentation? I don't like the way aliases are used here. These bindings are undocumented by the way :( :( :( I've applied it to wait and see what happens instead. 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
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c index 21d34d4d473dcefe..c3434146f605748b 100644 --- a/drivers/gpio/gpio-em.c +++ b/drivers/gpio/gpio-em.c @@ -330,12 +330,7 @@ static int em_gio_probe(struct platform_device *pdev) goto err0; } - ret = of_alias_get_id(pdev->dev.of_node, "gpio"); - if (ret < 0) { - dev_err(&pdev->dev, "Couldn't get OF id\n"); - goto err0; - } - pdata->gpio_base = ret * 32; /* 32 GPIOs per instance */ + pdata->gpio_base = -1; } gpio_chip = &p->gpio_chip;
Use dynamic allocation of GPIOs instead of looking at the gpio%u alias in DT. --- - Is this correct? Not having to care about the alias would simplify the to-be-written DT binding documentation. - Completely untested. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> drivers/gpio/gpio-em.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)