* Re: [PATCH, v1 1/1] gpio: aspeed: Add gpio base address reading
2021-01-13 22:38 ` [PATCH, v1 1/1] " Hongwei Zhang
@ 2021-01-14 0:27 ` Andrew Jeffery
2021-01-18 14:40 ` Linus Walleij
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Andrew Jeffery @ 2021-01-14 0:27 UTC (permalink / raw)
To: Hongwei Zhang, Linus Walleij, Bartosz Golaszewski, Joel Stanley,
linux-gpio, linux-arm-kernel, linux-aspeed, linux-kernel,
openbmc
Hello,
On Thu, 14 Jan 2021, at 09:08, Hongwei Zhang wrote:
> Add gpio base address reading in the driver; in old code, it just
> returns -1 to gpio->chip.base.
Why do you want to do this? It feels hacky. The base address only affects the
legacy sysfs number-space, and even then if you're using the sysfs interface
you can discover the base address for a specific gpiochip via the associated
attribute. For example:
# cat /sys/bus/platform/devices/1e780000.gpio/gpio/gpiochip*/base
816
I feel that you should instead be changing your userspace not to assume a fixed
value.
Finally, the base value is a linux-specific thing and doesn't belong in the
devicetree, and if it did, you would also need to update the devicetree binding
in Documentation/.
Cheers,
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, v1 1/1] gpio: aspeed: Add gpio base address reading
2021-01-13 22:38 ` [PATCH, v1 1/1] " Hongwei Zhang
2021-01-14 0:27 ` Andrew Jeffery
@ 2021-01-18 14:40 ` Linus Walleij
2021-02-05 16:34 ` Hongwei Zhang
2021-02-05 16:34 ` Hongwei Zhang
3 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2021-01-18 14:40 UTC (permalink / raw)
To: Hongwei Zhang
Cc: Bartosz Golaszewski, Joel Stanley, Andrew Jeffery,
open list:GPIO SUBSYSTEM, Linux ARM, linux-aspeed, linux-kernel,
OpenBMC Maillist
On Wed, Jan 13, 2021 at 11:38 PM Hongwei Zhang <hongweiz@ami.com> wrote:
> Add gpio base address reading in the driver; in old code, it just
> returns -1 to gpio->chip.base.
>
> Fixes: 7ee2d5b4d4340353 ("ARM: dts: nuvoton: Add Fii Kudo system")
> Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
NAK, sorry.
We never allow the device tree to specify this.
First, it is a Linux-only base so it would have to be a
"linux,..." property.
Even if it is a Linux-only property, it is a bad idea.
Only people using sysfs should have any need to specify global
GPIO numbers. Don't use sysfs. Use the GPIO character device
instead. See further:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/TODO
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH, v1 1/1] gpio: aspeed: Add gpio base address reading
2021-01-13 22:38 ` [PATCH, v1 1/1] " Hongwei Zhang
2021-01-14 0:27 ` Andrew Jeffery
2021-01-18 14:40 ` Linus Walleij
@ 2021-02-05 16:34 ` Hongwei Zhang
2021-02-05 16:34 ` Hongwei Zhang
3 siblings, 0 replies; 6+ messages in thread
From: Hongwei Zhang @ 2021-02-05 16:34 UTC (permalink / raw)
To: Linus Walleij
Cc: Hongwei Zhang, Bartosz Golaszewski, Joel Stanley, Andrew Jeffery,
linux-gpio, linux-arm-kernel, linux-aspeed, linux-kernel,
openbmc
> On Wed, Jan 13, 2021 at 11:38 PM Hongwei Zhang <hongweiz@ami.com> wrote:
>
> > Add gpio base address reading in the driver; in old code, it just
> > returns -1 to gpio->chip.base.
> >
> > Fixes: 7ee2d5b4d4340353 ("ARM: dts: nuvoton: Add Fii Kudo system")
> > Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
>
> NAK, sorry.
>
> We never allow the device tree to specify this.
>
> First, it is a Linux-only base so it would have to be a "linux,..." property.
>
> Even if it is a Linux-only property, it is a bad idea.
>
> Only people using sysfs should have any need to specify global GPIO numbers. Don't use sysfs. Use the
> GPIO character device instead. See further:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/TODO
>
> Yours,
> Linus Walleij
Hi Linus,
Thanks for your review and advice.
--Hongwei
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH, v1 1/1] gpio: aspeed: Add gpio base address reading
2021-01-13 22:38 ` [PATCH, v1 1/1] " Hongwei Zhang
` (2 preceding siblings ...)
2021-02-05 16:34 ` Hongwei Zhang
@ 2021-02-05 16:34 ` Hongwei Zhang
3 siblings, 0 replies; 6+ messages in thread
From: Hongwei Zhang @ 2021-02-05 16:34 UTC (permalink / raw)
To: Andrew Jeffery
Cc: Hongwei Zhang, Bartosz Golaszewski, Joel Stanley, Linus Walleij,
linux-gpio, linux-arm-kernel, linux-aspeed, linux-kernel,
openbmc
> Hello,
>
> On Thu, 14 Jan 2021, at 09:08, Hongwei Zhang wrote:
> > Add gpio base address reading in the driver; in old code, it just
> > returns -1 to gpio->chip.base.
>
> Why do you want to do this? It feels hacky. The base address only affects the legacy sysfs number-space,
> and even then if you're using the sysfs interface you can discover the base address for a specific gpiochip
> via the associated attribute. For example:
>
> # cat /sys/bus/platform/devices/1e780000.gpio/gpio/gpiochip*/base
> 816
>
> I feel that you should instead be changing your userspace not to assume a fixed value.
>
> Finally, the base value is a linux-specific thing and doesn't belong in the devicetree, and if it did, you
> would also need to update the devicetree binding in Documentation/.
>
> Cheers,
>
> Andrew
Hi Andrew,
Thanks for your review and advice.
--Hongwei
^ permalink raw reply [flat|nested] 6+ messages in thread