* [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
@ 2014-11-17 14:30 Geert Uytterhoeven
2014-11-17 14:34 ` Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2014-11-17 14:30 UTC (permalink / raw)
To: Magnus Damm, Linus Walleij, Alexandre Courbot
Cc: linux-gpio, devicetree, linux-sh, Geert Uytterhoeven
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;
}
gpio_chip = &p->gpio_chip;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
2014-11-17 14:30 [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs Geert Uytterhoeven
@ 2014-11-17 14:34 ` Arnd Bergmann
2014-11-17 14:42 ` Geert Uytterhoeven
2014-11-18 3:11 ` Alexandre Courbot
2014-11-27 14:13 ` Linus Walleij
2 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2014-11-17 14:34 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Linus Walleij, Alexandre Courbot, linux-gpio,
devicetree, linux-sh
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
2014-11-17 14:34 ` Arnd Bergmann
@ 2014-11-17 14:42 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2014-11-17 14:42 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Geert Uytterhoeven, Magnus Damm, Linus Walleij, Alexandre Courbot,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
Linux-sh list
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
2014-11-17 14:30 [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs Geert Uytterhoeven
2014-11-17 14:34 ` Arnd Bergmann
@ 2014-11-18 3:11 ` Alexandre Courbot
2014-11-27 14:17 ` Linus Walleij
2014-11-27 14:13 ` Linus Walleij
2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Courbot @ 2014-11-18 3:11 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Linus Walleij, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, Linux-SH
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
2014-11-18 3:11 ` Alexandre Courbot
@ 2014-11-27 14:17 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2014-11-27 14:17 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Geert Uytterhoeven, Magnus Damm, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, Linux-SH
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs
2014-11-17 14:30 [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs Geert Uytterhoeven
2014-11-17 14:34 ` Arnd Bergmann
2014-11-18 3:11 ` Alexandre Courbot
@ 2014-11-27 14:13 ` Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2014-11-27 14:13 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Alexandre Courbot, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-sh@vger.kernel.org
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-27 14:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 14:30 [PATCH/RFC] gpio: em: Use dynamic allocation of GPIOs Geert Uytterhoeven
2014-11-17 14:34 ` Arnd Bergmann
2014-11-17 14:42 ` Geert Uytterhoeven
2014-11-18 3:11 ` Alexandre Courbot
2014-11-27 14:17 ` Linus Walleij
2014-11-27 14:13 ` Linus Walleij
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).