* [PATCH 28/62] gpio: gpio-omap: Use new GPIO_LINE_DIRECTION
[not found] <cover.1572945849.git.matti.vaittinen@fi.rohmeurope.com>
@ 2019-11-05 10:25 ` Matti Vaittinen
2019-11-05 11:27 ` Grygorii Strashko
0 siblings, 1 reply; 2+ messages in thread
From: Matti Vaittinen @ 2019-11-05 10:25 UTC (permalink / raw)
To: matti.vaittinen, mazziesaccount
Cc: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Linus Walleij, Bartosz Golaszewski, linux-omap, linux-gpio,
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-omap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index d0f27084a942..3bd8adaeed9e 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -805,8 +805,10 @@ static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank = gpiochip_get_data(chip);
- return !!(readl_relaxed(bank->base + bank->regs->direction) &
- BIT(offset));
+ if (readl_relaxed(bank->base + bank->regs->direction) & BIT(offset))
+ return GPIO_LINE_DIRECTION_IN;
+
+ return GPIO_LINE_DIRECTION_OUT;
}
static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)
--
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 28/62] gpio: gpio-omap: Use new GPIO_LINE_DIRECTION
2019-11-05 10:25 ` [PATCH 28/62] gpio: gpio-omap: Use new GPIO_LINE_DIRECTION Matti Vaittinen
@ 2019-11-05 11:27 ` Grygorii Strashko
0 siblings, 0 replies; 2+ messages in thread
From: Grygorii Strashko @ 2019-11-05 11:27 UTC (permalink / raw)
To: Matti Vaittinen, mazziesaccount
Cc: Santosh Shilimkar, Kevin Hilman, Linus Walleij,
Bartosz Golaszewski, linux-omap, linux-gpio, linux-kernel
On 05/11/2019 12:25, 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>
> ---
> drivers/gpio/gpio-omap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index d0f27084a942..3bd8adaeed9e 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -805,8 +805,10 @@ static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
> {
> struct gpio_bank *bank = gpiochip_get_data(chip);
>
> - return !!(readl_relaxed(bank->base + bank->regs->direction) &
> - BIT(offset));
> + if (readl_relaxed(bank->base + bank->regs->direction) & BIT(offset))
> + return GPIO_LINE_DIRECTION_IN;
> +
> + return GPIO_LINE_DIRECTION_OUT;
> }
>
> static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)
>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
--
Best regards,
grygorii
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-05 11: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.1572945849.git.matti.vaittinen@fi.rohmeurope.com>
2019-11-05 10:25 ` [PATCH 28/62] gpio: gpio-omap: Use new GPIO_LINE_DIRECTION Matti Vaittinen
2019-11-05 11:27 ` Grygorii Strashko
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).