diff mbox

[v1] gpio: merrifield: Don't use GPIOF_DIR_IN / GPIOF_DIR_OUT

Message ID 20170323125632.89661-1-andriy.shevchenko@linux.intel.com
State New
Headers show

Commit Message

Andy Shevchenko March 23, 2017, 12:56 p.m. UTC
The mentioned flags are dedicated solely for consumer API.
Replace them by explicit values.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-merrifield.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij March 23, 2017, 1:06 p.m. UTC | #1
On Thu, Mar 23, 2017 at 1:56 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> The mentioned flags are dedicated solely for consumer API.
> Replace them by explicit values.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-merrifield.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index f40088d268c1..96dc5123a58a 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -166,7 +166,7 @@ static int mrfld_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
>  {
>         void __iomem *gpdr = gpio_reg(chip, offset, GPDR);
>
> -       return (readl(gpdr) & BIT(offset % 32)) ? GPIOF_DIR_OUT : GPIOF_DIR_IN;
> +       return (readl(gpdr) & BIT(offset % 32)) ? 0 : 1;

I would normally just do this to clamp to [0,1]:

return !(readl(gpdr) & BIT(offset % 32));

So did that fix in the commit.

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 mbox

Patch

diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index f40088d268c1..96dc5123a58a 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -166,7 +166,7 @@  static int mrfld_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 {
 	void __iomem *gpdr = gpio_reg(chip, offset, GPDR);
 
-	return (readl(gpdr) & BIT(offset % 32)) ? GPIOF_DIR_OUT : GPIOF_DIR_IN;
+	return (readl(gpdr) & BIT(offset % 32)) ? 0 : 1;
 }
 
 static int mrfld_gpio_set_debounce(struct gpio_chip *chip, unsigned int offset,