gpio: dwapb: fix bgpio usage

Message ID 20171020102951.6305-1-linus.walleij@linaro.org
State Accepted
Commit d97a1b5688b015d94d0365b032c0659957a9e9d1
Headers show
Series
  • gpio: dwapb: fix bgpio usage
Related show

Commit Message

Linus Walleij Oct. 20, 2017, 10:29 a.m.
The DW APB GPIO driver uses the generic GPIO library gpio-mmio,
and initialize the flags as "false", which should be 0.

When no flags are given, the native endianness is used to access
the MMIO registers, and the pin2mask() call can simply be
converted to a BIT() call, as per the default pin2mask()
implementation in gpio-mmio.c.

Cc: Hoan Tran <hotran@apm.com>
Cc: Alan Tull <atull@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/gpio/gpio-dwapb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.13.6

--
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

Comments

Alan Tull Oct. 24, 2017, 8:22 p.m. | #1
On Fri, Oct 20, 2017 at 5:29 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> The DW APB GPIO driver uses the generic GPIO library gpio-mmio,

> and initialize the flags as "false", which should be 0.

>

> When no flags are given, the native endianness is used to access

> the MMIO registers, and the pin2mask() call can simply be

> converted to a BIT() call, as per the default pin2mask()

> implementation in gpio-mmio.c.

>

> Cc: Hoan Tran <hotran@apm.com>

> Cc: Alan Tull <atull@kernel.org>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Acked-by: Alan Tull <atull@kernel.org>


> ---

>  drivers/gpio/gpio-dwapb.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c

> index d782ad195c89..6730c6642ce3 100644

> --- a/drivers/gpio/gpio-dwapb.c

> +++ b/drivers/gpio/gpio-dwapb.c

> @@ -320,7 +320,7 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc,

>         struct dwapb_gpio_port *port = gpiochip_get_data(gc);

>         struct dwapb_gpio *gpio = port->gpio;

>         unsigned long flags, val_deb;

> -       unsigned long mask = gc->pin2mask(gc, offset);

> +       unsigned long mask = BIT(offset);

>

>         spin_lock_irqsave(&gc->bgpio_lock, flags);

>

> @@ -482,7 +482,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,

>                 (pp->idx * GPIO_SWPORT_DDR_SIZE);

>

>         err = bgpio_init(&port->gc, gpio->dev, 4, dat, set, NULL, dirout,

> -                        NULL, false);

> +                        NULL, 0);

>         if (err) {

>                 dev_err(gpio->dev, "failed to init gpio chip for port%d\n",

>                         port->idx);

> --

> 2.13.6

>

--
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

Patch

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index d782ad195c89..6730c6642ce3 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -320,7 +320,7 @@  static int dwapb_gpio_set_debounce(struct gpio_chip *gc,
 	struct dwapb_gpio_port *port = gpiochip_get_data(gc);
 	struct dwapb_gpio *gpio = port->gpio;
 	unsigned long flags, val_deb;
-	unsigned long mask = gc->pin2mask(gc, offset);
+	unsigned long mask = BIT(offset);
 
 	spin_lock_irqsave(&gc->bgpio_lock, flags);
 
@@ -482,7 +482,7 @@  static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
 		(pp->idx * GPIO_SWPORT_DDR_SIZE);
 
 	err = bgpio_init(&port->gc, gpio->dev, 4, dat, set, NULL, dirout,
-			 NULL, false);
+			 NULL, 0);
 	if (err) {
 		dev_err(gpio->dev, "failed to init gpio chip for port%d\n",
 			port->idx);