* [PATCH 07/62] gpio: gpio-aspeed: Use new GPIO_LINE_DIRECTION
[not found] <cover.1572945709.git.matti.vaittinen@fi.rohmeurope.com>
@ 2019-11-05 10:12 ` Matti Vaittinen
2019-11-27 23:28 ` Andrew Jeffery
0 siblings, 1 reply; 2+ messages in thread
From: Matti Vaittinen @ 2019-11-05 10:12 UTC (permalink / raw)
To: matti.vaittinen, mazziesaccount
Cc: Linus Walleij, Bartosz Golaszewski, Joel Stanley, Andrew Jeffery,
linux-gpio, linux-arm-kernel, linux-aspeed, linux-kernel
It's hard for occasional GPIO code reader/writer to know if values 0/1
equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
GPIO_LINE_DIRECTION_OUT to help them out.
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
drivers/gpio/gpio-aspeed.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 09e53c5f3b0a..f1037b61f763 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -487,10 +487,10 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
u32 val;
if (!have_input(gpio, offset))
- return 0;
+ return GPIO_LINE_DIRECTION_OUT;
if (!have_output(gpio, offset))
- return 1;
+ return GPIO_LINE_DIRECTION_IN;
spin_lock_irqsave(&gpio->lock, flags);
@@ -498,8 +498,7 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
spin_unlock_irqrestore(&gpio->lock, flags);
- return !val;
-
+ return val ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
}
static inline int irqd_to_aspeed_gpio_data(struct irq_data *d,
--
2.21.0
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 07/62] gpio: gpio-aspeed: Use new GPIO_LINE_DIRECTION
2019-11-05 10:12 ` [PATCH 07/62] gpio: gpio-aspeed: Use new GPIO_LINE_DIRECTION Matti Vaittinen
@ 2019-11-27 23:28 ` Andrew Jeffery
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jeffery @ 2019-11-27 23:28 UTC (permalink / raw)
To: Matti Vaittinen, mazziesaccount
Cc: Linus Walleij, Bartosz Golaszewski, Joel Stanley, linux-gpio,
linux-arm-kernel, linux-aspeed, linux-kernel
On Tue, 5 Nov 2019, at 20:42, Matti Vaittinen wrote:
> It's hard for occasional GPIO code reader/writer to know if values 0/1
> equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
> GPIO_LINE_DIRECTION_OUT to help them out.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Not sure where the series is at, but this looks fine to me:
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-27 23:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1572945709.git.matti.vaittinen@fi.rohmeurope.com>
2019-11-05 10:12 ` [PATCH 07/62] gpio: gpio-aspeed: Use new GPIO_LINE_DIRECTION Matti Vaittinen
2019-11-27 23:28 ` Andrew Jeffery
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).