linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags
@ 2019-08-20 13:59 Linus Walleij
  2019-08-20 13:59 ` [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers Linus Walleij
  2019-08-21  7:44 ` [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2019-08-20 13:59 UTC (permalink / raw)
  To: linux-gpio
  Cc: Bartosz Golaszewski, Linus Walleij, Chris Brandt, Geert Uytterhoeven

These flags are for consumers of GPIO lines, not for
drivers.

Cc: Chris Brandt <chris.brandt@renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v3:
- New patch for just this.
---
 drivers/pinctrl/pinctrl-rza2.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rza2.c b/drivers/pinctrl/pinctrl-rza2.c
index 5b951c7422cc..b0806667e94c 100644
--- a/drivers/pinctrl/pinctrl-rza2.c
+++ b/drivers/pinctrl/pinctrl-rza2.c
@@ -115,7 +115,7 @@ static void rza2_pin_to_gpio(void __iomem *pfc_base, unsigned int offset,
 	mask16 = RZA2_PDR_MASK << (pin * 2);
 	reg16 &= ~mask16;
 
-	if (dir == GPIOF_DIR_IN)
+	if (dir)
 		reg16 |= RZA2_PDR_INPUT << (pin * 2);	/* pin as input */
 	else
 		reg16 |= RZA2_PDR_OUTPUT << (pin * 2);	/* pin as output */
@@ -134,18 +134,18 @@ static int rza2_chip_get_direction(struct gpio_chip *chip, unsigned int offset)
 	reg16 = (reg16 >> (pin * 2)) & RZA2_PDR_MASK;
 
 	if (reg16 == RZA2_PDR_OUTPUT)
-		return GPIOF_DIR_OUT;
+		return 0;
 
 	if (reg16 == RZA2_PDR_INPUT)
-		return GPIOF_DIR_IN;
+		return 1;
 
 	/*
 	 * This GPIO controller has a default Hi-Z state that is not input or
 	 * output, so force the pin to input now.
 	 */
-	rza2_pin_to_gpio(priv->base, offset, GPIOF_DIR_IN);
+	rza2_pin_to_gpio(priv->base, offset, 1);
 
-	return GPIOF_DIR_IN;
+	return 1;
 }
 
 static int rza2_chip_direction_input(struct gpio_chip *chip,
@@ -153,7 +153,7 @@ static int rza2_chip_direction_input(struct gpio_chip *chip,
 {
 	struct rza2_pinctrl_priv *priv = gpiochip_get_data(chip);
 
-	rza2_pin_to_gpio(priv->base, offset, GPIOF_DIR_IN);
+	rza2_pin_to_gpio(priv->base, offset, 1);
 
 	return 0;
 }
@@ -191,7 +191,7 @@ static int rza2_chip_direction_output(struct gpio_chip *chip,
 	struct rza2_pinctrl_priv *priv = gpiochip_get_data(chip);
 
 	rza2_chip_set(chip, offset, val);
-	rza2_pin_to_gpio(priv->base, offset, GPIOF_DIR_OUT);
+	rza2_pin_to_gpio(priv->base, offset, 0);
 
 	return 0;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers
  2019-08-20 13:59 [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Linus Walleij
@ 2019-08-20 13:59 ` Linus Walleij
  2019-08-21  7:45   ` Geert Uytterhoeven
  2019-08-21  7:44 ` [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Geert Uytterhoeven
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2019-08-20 13:59 UTC (permalink / raw)
  To: linux-gpio
  Cc: Bartosz Golaszewski, Linus Walleij, Chris Brandt, Geert Uytterhoeven

This driver is implementing a GPIO driver so include
<linux/gpio/driver.h> and not the legacy API <linux/gpio.h>.
When testing it turns out it also relies on implicit
inclusion of <linux/io.h> (readw etc) so make sure to
include that as well.

Cc: Chris Brandt <chris.brandt@renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLov v2->v3:
- Fix one more instance.
- Test compile properly.
ChangeLog v1->v2:
- Remove the use of GPIOF_* consumer flags in the driver.
---
 drivers/pinctrl/pinctrl-rza2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-rza2.c b/drivers/pinctrl/pinctrl-rza2.c
index b0806667e94c..3be1d833bf25 100644
--- a/drivers/pinctrl/pinctrl-rza2.c
+++ b/drivers/pinctrl/pinctrl-rza2.c
@@ -11,7 +11,8 @@
  */
 
 #include <linux/bitops.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/pinmux.h>
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags
  2019-08-20 13:59 [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Linus Walleij
  2019-08-20 13:59 ` [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers Linus Walleij
@ 2019-08-21  7:44 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-08-21  7:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Chris Brandt,
	Geert Uytterhoeven

On Tue, Aug 20, 2019 at 4:00 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> These flags are for consumers of GPIO lines, not for
> drivers.
>
> Cc: Chris Brandt <chris.brandt@renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in sh-pfc-for-v5.4.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers
  2019-08-20 13:59 ` [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers Linus Walleij
@ 2019-08-21  7:45   ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-08-21  7:45 UTC (permalink / raw)
  To: Linus Walleij
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Chris Brandt,
	Geert Uytterhoeven

On Tue, Aug 20, 2019 at 4:00 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> This driver is implementing a GPIO driver so include
> <linux/gpio/driver.h> and not the legacy API <linux/gpio.h>.
> When testing it turns out it also relies on implicit
> inclusion of <linux/io.h> (readw etc) so make sure to
> include that as well.
>
> Cc: Chris Brandt <chris.brandt@renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in sh-pfc-for-v5.4.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-21  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 13:59 [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Linus Walleij
2019-08-20 13:59 ` [PATCH 2/2 v3] pinctrl: rza2: Include the appropriate headers Linus Walleij
2019-08-21  7:45   ` Geert Uytterhoeven
2019-08-21  7:44 ` [PATCH 1/2 v3] pinctrl: rza2: Drop driver use of consumer flags Geert Uytterhoeven

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