All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/5] gpiochip: add and use generic request/free
@ 2015-10-11 15:34 Jonas Gorski
  2015-10-11 15:34 ` [PATCH V2 1/5] gpiolib: provide generic request/free implementations Jonas Gorski
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

A lot of pinctrl aware gpio chip drivers use the following pattern:

int foo_request_gpio(struct gpio_chip *gc, unsigned offset)
{
        return pinctrl_request_gpio(gc->base + offset);
}

void foo_request_gpio(struct gpio_chip *gc, unsigned offset)
{
        pinctrl_free_gpio(gc->base + offset);
}

static struct gpio_chip foo_chip {
        ...
        .request = foo_request_gpio;
        .free = foo_request_gpio;
        ...
};

To prevent this from spreading any further, add and export generic
versions that gpio chip drivers can just use.

* Patch 1 adds the trivial implementations.
* Patch 2 replaces all identical (+/- debug output/comments) versions
  in gpio/
* Patch 3/4 modifies drivers that use a boolean for conditional calling
  request/free by just not populating the callbacks if the boolean is
  false (which is only set at probe)
* Patch 5 replaces all identical version in pinctrl/

Build tested as far as possible (which isn't much when only using
COMPILE_TEST, even when forcing PINCTRL to y).

I don't expect this to break anything, and I triple checked that I did
not introduce any typos, but I can't actually test most of the changed
drivers lacking hardware.

Patches apply cleanly to HEAD of linux-gpio/for-next.

Changes RFT -> V2:
 * rebased onto current HEAD
 * renamed gpio argument of callbacks to offset and reworded the
   description.

Jonas Gorski (5):
  gpiolib: provide generic request/free implementations
  gpio: replace trivial implementations of request/free with generic one
  gpio: gpio-xz: use the generic request/free implementations
  gpio: gpio-pl061: use the generic request/free implementations
  pinctrl: replace trivial implementations of gpio_chip request/free

 drivers/gpio/gpio-lpc18xx.c                   | 14 ++----------
 drivers/gpio/gpio-moxart.c                    | 14 ++----------
 drivers/gpio/gpio-mvebu.c                     | 14 ++----------
 drivers/gpio/gpio-pl061.c                     | 32 ++++-----------------------
 drivers/gpio/gpio-tb10x.c                     | 14 ++----------
 drivers/gpio/gpio-tz1090-pdc.c                | 14 ++----------
 drivers/gpio/gpio-vf610.c                     | 14 ++----------
 drivers/gpio/gpio-zx.c                        | 28 ++++-------------------
 drivers/gpio/gpiolib.c                        | 23 +++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm2835.c         | 14 ++----------
 drivers/pinctrl/intel/pinctrl-cherryview.c    | 14 ++----------
 drivers/pinctrl/intel/pinctrl-intel.c         | 14 ++----------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++----------
 drivers/pinctrl/nomadik/pinctrl-abx500.c      | 18 ++-------------
 drivers/pinctrl/nomadik/pinctrl-nomadik.c     | 22 ++----------------
 drivers/pinctrl/pinctrl-adi2.c                | 14 ++----------
 drivers/pinctrl/pinctrl-as3722.c              | 14 ++----------
 drivers/pinctrl/pinctrl-at91.c                | 26 ++--------------------
 drivers/pinctrl/pinctrl-coh901.c              | 22 ++----------------
 drivers/pinctrl/pinctrl-digicolor.c           | 14 ++----------
 drivers/pinctrl/pinctrl-pistachio.c           | 14 ++----------
 drivers/pinctrl/pinctrl-rockchip.c            | 14 ++----------
 drivers/pinctrl/pinctrl-st.c                  | 14 ++----------
 drivers/pinctrl/pinctrl-xway.c                | 18 ++-------------
 drivers/pinctrl/qcom/pinctrl-msm.c            | 16 ++------------
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c      | 14 ++----------
 drivers/pinctrl/qcom/pinctrl-spmi-mpp.c       | 14 ++----------
 drivers/pinctrl/samsung/pinctrl-samsung.c     | 14 ++----------
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 14 ++----------
 drivers/pinctrl/vt8500/pinctrl-wmt.c          | 14 ++----------
 include/linux/gpio/driver.h                   |  3 +++
 31 files changed, 88 insertions(+), 414 deletions(-)

-- 
2.1.4

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

* [PATCH V2 1/5] gpiolib: provide generic request/free implementations
  2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
@ 2015-10-11 15:34 ` Jonas Gorski
  2015-10-16 20:11   ` Linus Walleij
  2015-10-11 15:34 ` [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one Jonas Gorski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

Provide generic request/free implementations that pinctrl aware gpio
drivers can use instead of open coding if they use a 1:1 pin to gpio
signal mapping.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
RFC -> V2:
 * renamed gpio to offset

 drivers/gpio/gpiolib.c      | 23 +++++++++++++++++++++++
 include/linux/gpio/driver.h |  3 +++
 2 files changed, 26 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8f18077..8eba02d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -15,6 +15,7 @@
 #include <linux/acpi.h>
 #include <linux/gpio/driver.h>
 #include <linux/gpio/machine.h>
+#include <linux/pinctrl/consumer.h>
 
 #include "gpiolib.h"
 
@@ -745,6 +746,28 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) {}
 
 #endif /* CONFIG_GPIOLIB_IRQCHIP */
 
+/**
+ * gpiochip_generic_request() - request the gpio function for a pin
+ * @chip: the gpiochip owning the GPIO
+ * @offset: the offset of the GPIO to request for GPIO function
+ */
+int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
+{
+	return pinctrl_request_gpio(chip->base + offset);
+}
+EXPORT_SYMBOL_GPL(gpiochip_generic_request);
+
+/**
+ * gpiochip_generic_free() - free the gpio function from a pin
+ * @chip: the gpiochip to request the gpio function for
+ * @offset: the offset of the GPIO to free from GPIO function
+ */
+void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset)
+{
+	pinctrl_free_gpio(chip->base + offset);
+}
+EXPORT_SYMBOL_GPL(gpiochip_generic_free);
+
 #ifdef CONFIG_PINCTRL
 
 /**
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 1aed31c..d1baebf 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -206,6 +206,9 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
 
 #endif /* CONFIG_GPIOLIB_IRQCHIP */
 
+int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset);
+void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset);
+
 #ifdef CONFIG_PINCTRL
 
 /**
-- 
2.1.4

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

* [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one
  2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
  2015-10-11 15:34 ` [PATCH V2 1/5] gpiolib: provide generic request/free implementations Jonas Gorski
@ 2015-10-11 15:34 ` Jonas Gorski
  2015-10-12 13:08   ` Gregory CLEMENT
  2015-10-16 20:14   ` Linus Walleij
  2015-10-11 15:34 ` [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations Jonas Gorski
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

Replace all trivial request/free callbacks that do nothing but call into
pinctrl code with the generic versions.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Stefan Agner <stefan@agner.ch>
Acked-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/gpio/gpio-lpc18xx.c    | 14 ++------------
 drivers/gpio/gpio-moxart.c     | 14 ++------------
 drivers/gpio/gpio-mvebu.c      | 14 ++------------
 drivers/gpio/gpio-tb10x.c      | 14 ++------------
 drivers/gpio/gpio-tz1090-pdc.c | 14 ++------------
 drivers/gpio/gpio-vf610.c      | 14 ++------------
 6 files changed, 12 insertions(+), 72 deletions(-)

diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index eb68603..e39dcb0 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -36,16 +36,6 @@ static inline struct lpc18xx_gpio_chip *to_lpc18xx_gpio(struct gpio_chip *chip)
 	return container_of(chip, struct lpc18xx_gpio_chip, gpio);
 }
 
-static int lpc18xx_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(offset);
-}
-
-static void lpc18xx_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(offset);
-}
-
 static void lpc18xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip);
@@ -95,8 +85,8 @@ static int lpc18xx_gpio_direction_output(struct gpio_chip *chip,
 
 static struct gpio_chip lpc18xx_chip = {
 	.label			= "lpc18xx/43xx-gpio",
-	.request		= lpc18xx_gpio_request,
-	.free			= lpc18xx_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.direction_input	= lpc18xx_gpio_direction_input,
 	.direction_output	= lpc18xx_gpio_direction_output,
 	.set			= lpc18xx_gpio_set,
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
index abd8676..d3355a6 100644
--- a/drivers/gpio/gpio-moxart.c
+++ b/drivers/gpio/gpio-moxart.c
@@ -29,16 +29,6 @@
 #define GPIO_DATA_IN		0x04
 #define GPIO_PIN_DIRECTION	0x08
 
-static int moxart_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(offset);
-}
-
-static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(offset);
-}
-
 static int moxart_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -66,8 +56,8 @@ static int moxart_gpio_probe(struct platform_device *pdev)
 	}
 
 	bgc->gc.label = "moxart-gpio";
-	bgc->gc.request = moxart_gpio_request;
-	bgc->gc.free = moxart_gpio_free;
+	bgc->gc.request = gpiochip_generic_request;
+	bgc->gc.free = gpiochip_generic_free;
 	bgc->data = bgc->read_reg(bgc->reg_set);
 	bgc->gc.base = 0;
 	bgc->gc.ngpio = 32;
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index df418b8..d428b97 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -185,16 +185,6 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip)
  * Functions implementing the gpio_chip methods
  */
 
-static int mvebu_gpio_request(struct gpio_chip *chip, unsigned pin)
-{
-	return pinctrl_request_gpio(chip->base + pin);
-}
-
-static void mvebu_gpio_free(struct gpio_chip *chip, unsigned pin)
-{
-	pinctrl_free_gpio(chip->base + pin);
-}
-
 static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
 {
 	struct mvebu_gpio_chip *mvchip =
@@ -709,8 +699,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
 	mvchip->soc_variant = soc_variant;
 	mvchip->chip.label = dev_name(&pdev->dev);
 	mvchip->chip.dev = &pdev->dev;
-	mvchip->chip.request = mvebu_gpio_request;
-	mvchip->chip.free = mvebu_gpio_free;
+	mvchip->chip.request = gpiochip_generic_request;
+	mvchip->chip.free = gpiochip_generic_free;
 	mvchip->chip.direction_input = mvebu_gpio_direction_input;
 	mvchip->chip.get = mvebu_gpio_get;
 	mvchip->chip.direction_output = mvebu_gpio_direction_output;
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index 12c99d9..4356e6c 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -138,16 +138,6 @@ static int tb10x_gpio_direction_out(struct gpio_chip *chip,
 	return 0;
 }
 
-static int tb10x_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void tb10x_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int tb10x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
 	struct tb10x_gpio *tb10x_gpio = to_tb10x_gpio(chip);
@@ -213,8 +203,8 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
 	tb10x_gpio->gc.get		= tb10x_gpio_get;
 	tb10x_gpio->gc.direction_output	= tb10x_gpio_direction_out;
 	tb10x_gpio->gc.set		= tb10x_gpio_set;
-	tb10x_gpio->gc.request		= tb10x_gpio_request;
-	tb10x_gpio->gc.free		= tb10x_gpio_free;
+	tb10x_gpio->gc.request		= gpiochip_generic_request;
+	tb10x_gpio->gc.free		= gpiochip_generic_free;
 	tb10x_gpio->gc.base		= -1;
 	tb10x_gpio->gc.ngpio		= ngpio;
 	tb10x_gpio->gc.can_sleep	= false;
diff --git a/drivers/gpio/gpio-tz1090-pdc.c b/drivers/gpio/gpio-tz1090-pdc.c
index ede7e40..3623d00 100644
--- a/drivers/gpio/gpio-tz1090-pdc.c
+++ b/drivers/gpio/gpio-tz1090-pdc.c
@@ -137,16 +137,6 @@ static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	__global_unlock2(lstat);
 }
 
-static int tz1090_pdc_gpio_request(struct gpio_chip *chip, unsigned int offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void tz1090_pdc_gpio_free(struct gpio_chip *chip, unsigned int offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int tz1090_pdc_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
 {
 	struct tz1090_pdc_gpio *priv = to_pdc(chip);
@@ -203,8 +193,8 @@ static int tz1090_pdc_gpio_probe(struct platform_device *pdev)
 	priv->chip.direction_output	= tz1090_pdc_gpio_direction_output;
 	priv->chip.get			= tz1090_pdc_gpio_get;
 	priv->chip.set			= tz1090_pdc_gpio_set;
-	priv->chip.free			= tz1090_pdc_gpio_free;
-	priv->chip.request		= tz1090_pdc_gpio_request;
+	priv->chip.free			= gpiochip_generic_free;
+	priv->chip.request		= gpiochip_generic_request;
 	priv->chip.to_irq		= tz1090_pdc_gpio_to_irq;
 	priv->chip.of_node		= np;
 
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index e1a3971..87b950c 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -82,16 +82,6 @@ static inline u32 vf610_gpio_readl(void __iomem *reg)
 	return readl_relaxed(reg);
 }
 
-static int vf610_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void vf610_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio)
 {
 	struct vf610_gpio_port *port = to_vf610_gp(gc);
@@ -264,8 +254,8 @@ static int vf610_gpio_probe(struct platform_device *pdev)
 	gc->ngpio = VF610_GPIO_PER_PORT;
 	gc->base = of_alias_get_id(np, "gpio") * VF610_GPIO_PER_PORT;
 
-	gc->request = vf610_gpio_request;
-	gc->free = vf610_gpio_free;
+	gc->request = gpiochip_generic_request;
+	gc->free = gpiochip_generic_free;
 	gc->direction_input = vf610_gpio_direction_input;
 	gc->get = vf610_gpio_get;
 	gc->direction_output = vf610_gpio_direction_output;
-- 
2.1.4

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

* [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations
  2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
  2015-10-11 15:34 ` [PATCH V2 1/5] gpiolib: provide generic request/free implementations Jonas Gorski
  2015-10-11 15:34 ` [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one Jonas Gorski
@ 2015-10-11 15:34 ` Jonas Gorski
  2015-10-16 20:16   ` Linus Walleij
  2015-10-11 15:34 ` [PATCH V2 4/5] gpio: gpio-pl061: " Jonas Gorski
  2015-10-11 15:34 ` [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free Jonas Gorski
  4 siblings, 1 reply; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

Instead of storing in the chip data whether the chip uses pinctrl and
conditionally call pinctrl_{request,free}_gpio, just don't populate
request/free in that case.

This makes the implementations trivial and the same as the generic
implementations, thus we can just use them.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 drivers/gpio/gpio-zx.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/gpio/gpio-zx.c b/drivers/gpio/gpio-zx.c
index 4b8a269..1dcf7a6 100644
--- a/drivers/gpio/gpio-zx.c
+++ b/drivers/gpio/gpio-zx.c
@@ -41,7 +41,6 @@ struct zx_gpio {
 
 	void __iomem		*base;
 	struct gpio_chip	gc;
-	bool			uses_pinctrl;
 };
 
 static inline struct zx_gpio *to_zx(struct gpio_chip *gc)
@@ -49,25 +48,6 @@ static inline struct zx_gpio *to_zx(struct gpio_chip *gc)
 	return container_of(gc, struct zx_gpio, gc);
 }
 
-static int zx_gpio_request(struct gpio_chip *gc, unsigned offset)
-{
-	struct zx_gpio *chip = to_zx(gc);
-	int gpio = gc->base + offset;
-
-	if (chip->uses_pinctrl)
-		return pinctrl_request_gpio(gpio);
-	return 0;
-}
-
-static void zx_gpio_free(struct gpio_chip *gc, unsigned offset)
-{
-	struct zx_gpio *chip = to_zx(gc);
-	int gpio = gc->base + offset;
-
-	if (chip->uses_pinctrl)
-		pinctrl_free_gpio(gpio);
-}
-
 static int zx_direction_input(struct gpio_chip *gc, unsigned offset)
 {
 	struct zx_gpio *chip = to_zx(gc);
@@ -252,12 +232,12 @@ static int zx_gpio_probe(struct platform_device *pdev)
 		return PTR_ERR(chip->base);
 
 	spin_lock_init(&chip->lock);
-	if (of_property_read_bool(dev->of_node, "gpio-ranges"))
-		chip->uses_pinctrl = true;
+	if (of_property_read_bool(dev->of_node, "gpio-ranges")) {
+		chip->gc.request = gpiochip_generic_request;
+		chip->gc.free = gpiochip_generic_free;
+	}
 
 	id = of_alias_get_id(dev->of_node, "gpio");
-	chip->gc.request = zx_gpio_request;
-	chip->gc.free = zx_gpio_free;
 	chip->gc.direction_input = zx_direction_input;
 	chip->gc.direction_output = zx_direction_output;
 	chip->gc.get = zx_get_value;
-- 
2.1.4

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

* [PATCH V2 4/5] gpio: gpio-pl061: use the generic request/free implementations
  2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
                   ` (2 preceding siblings ...)
  2015-10-11 15:34 ` [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations Jonas Gorski
@ 2015-10-11 15:34 ` Jonas Gorski
  2015-10-16 20:17   ` Linus Walleij
  2015-10-11 15:34 ` [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free Jonas Gorski
  4 siblings, 1 reply; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

Instead of storing in the chip data whether the chip uses pinctrl and
conditionally call pinctrl_{request,free}_gpio, just don't populate
request/free in that case.

This makes the implementations trivial and the same as the generic
implementations, thus we can just use them.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 drivers/gpio/gpio-pl061.c | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 5b1461f..9d661d4 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -52,36 +52,12 @@ struct pl061_gpio {
 
 	void __iomem		*base;
 	struct gpio_chip	gc;
-	bool			uses_pinctrl;
 
 #ifdef CONFIG_PM
 	struct pl061_context_save_regs csave_regs;
 #endif
 };
 
-static int pl061_gpio_request(struct gpio_chip *gc, unsigned offset)
-{
-	/*
-	 * Map back to global GPIO space and request muxing, the direction
-	 * parameter does not matter for this controller.
-	 */
-	struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
-	int gpio = gc->base + offset;
-
-	if (chip->uses_pinctrl)
-		return pinctrl_request_gpio(gpio);
-	return 0;
-}
-
-static void pl061_gpio_free(struct gpio_chip *gc, unsigned offset)
-{
-	struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
-	int gpio = gc->base + offset;
-
-	if (chip->uses_pinctrl)
-		pinctrl_free_gpio(gpio);
-}
-
 static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
 {
 	struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
@@ -308,11 +284,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 		return PTR_ERR(chip->base);
 
 	spin_lock_init(&chip->lock);
-	if (of_property_read_bool(dev->of_node, "gpio-ranges"))
-		chip->uses_pinctrl = true;
+	if (of_property_read_bool(dev->of_node, "gpio-ranges")) {
+		chip->gc.request = gpiochip_generic_request;
+		chip->gc.free = gpiochip_generic_free;
+	}
 
-	chip->gc.request = pl061_gpio_request;
-	chip->gc.free = pl061_gpio_free;
 	chip->gc.direction_input = pl061_direction_input;
 	chip->gc.direction_output = pl061_direction_output;
 	chip->gc.get = pl061_get_value;
-- 
2.1.4

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

* [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free
  2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
                   ` (3 preceding siblings ...)
  2015-10-11 15:34 ` [PATCH V2 4/5] gpio: gpio-pl061: " Jonas Gorski
@ 2015-10-11 15:34 ` Jonas Gorski
  2015-10-11 15:43   ` Maxime Ripard
  2015-10-16 20:20   ` Linus Walleij
  4 siblings, 2 replies; 13+ messages in thread
From: Jonas Gorski @ 2015-10-11 15:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko

Replace all trivial request/free callbacks that do nothing but call into
pinctrl code with the generic versions.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: Lee Jones <lee@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c         | 14 ++------------
 drivers/pinctrl/intel/pinctrl-cherryview.c    | 14 ++------------
 drivers/pinctrl/intel/pinctrl-intel.c         | 14 ++------------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++------------
 drivers/pinctrl/nomadik/pinctrl-abx500.c      | 18 ++----------------
 drivers/pinctrl/nomadik/pinctrl-nomadik.c     | 22 ++--------------------
 drivers/pinctrl/pinctrl-adi2.c                | 14 ++------------
 drivers/pinctrl/pinctrl-as3722.c              | 14 ++------------
 drivers/pinctrl/pinctrl-at91.c                | 26 ++------------------------
 drivers/pinctrl/pinctrl-coh901.c              | 22 ++--------------------
 drivers/pinctrl/pinctrl-digicolor.c           | 14 ++------------
 drivers/pinctrl/pinctrl-pistachio.c           | 14 ++------------
 drivers/pinctrl/pinctrl-rockchip.c            | 14 ++------------
 drivers/pinctrl/pinctrl-st.c                  | 14 ++------------
 drivers/pinctrl/pinctrl-xway.c                | 18 ++----------------
 drivers/pinctrl/qcom/pinctrl-msm.c            | 16 ++--------------
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c      | 14 ++------------
 drivers/pinctrl/qcom/pinctrl-spmi-mpp.c       | 14 ++------------
 drivers/pinctrl/samsung/pinctrl-samsung.c     | 14 ++------------
 drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 14 ++------------
 drivers/pinctrl/vt8500/pinctrl-wmt.c          | 14 ++------------
 21 files changed, 42 insertions(+), 290 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 8efa235..a1ea565 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -330,16 +330,6 @@ static inline void bcm2835_pinctrl_fsel_set(
 	bcm2835_gpio_wr(pc, FSEL_REG(pin), val);
 }
 
-static int bcm2835_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void bcm2835_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
 	return pinctrl_gpio_direction_input(chip->base + offset);
@@ -375,8 +365,8 @@ static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 static struct gpio_chip bcm2835_gpio_chip = {
 	.label = MODULE_NAME,
 	.owner = THIS_MODULE,
-	.request = bcm2835_gpio_request,
-	.free = bcm2835_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.direction_input = bcm2835_gpio_direction_input,
 	.direction_output = bcm2835_gpio_direction_output,
 	.get = bcm2835_gpio_get,
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 270c127..84936ba 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1149,16 +1149,6 @@ static struct pinctrl_desc chv_pinctrl_desc = {
 	.owner = THIS_MODULE,
 };
 
-static int chv_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void chv_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static unsigned chv_gpio_offset_to_pin(struct chv_pinctrl *pctrl,
 				       unsigned offset)
 {
@@ -1238,8 +1228,8 @@ static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 
 static const struct gpio_chip chv_gpio_chip = {
 	.owner = THIS_MODULE,
-	.request = chv_gpio_request,
-	.free = chv_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.get_direction = chv_gpio_get_direction,
 	.direction_input = chv_gpio_direction_input,
 	.direction_output = chv_gpio_direction_output,
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 54848b8..928a00b 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -597,16 +597,6 @@ static const struct pinctrl_desc intel_pinctrl_desc = {
 	.owner = THIS_MODULE,
 };
 
-static int intel_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void intel_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(chip);
@@ -654,8 +644,8 @@ static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 
 static const struct gpio_chip intel_gpio_chip = {
 	.owner = THIS_MODULE,
-	.request = intel_gpio_request,
-	.free = intel_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.direction_input = intel_gpio_direction_input,
 	.direction_output = intel_gpio_direction_output,
 	.get = intel_gpio_get,
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 1b22f96..f8fafc1 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -723,16 +723,6 @@ static const struct pinmux_ops mtk_pmx_ops = {
 	.gpio_set_direction	= mtk_pmx_gpio_set_direction,
 };
 
-static int mtk_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void mtk_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int mtk_gpio_direction_input(struct gpio_chip *chip,
 					unsigned offset)
 {
@@ -1005,8 +995,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
 
 static struct gpio_chip mtk_gpio_chip = {
 	.owner			= THIS_MODULE,
-	.request		= mtk_gpio_request,
-	.free			= mtk_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.direction_input	= mtk_gpio_direction_input,
 	.direction_output	= mtk_gpio_direction_output,
 	.get			= mtk_gpio_get,
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c
index 97681fa..b59fbb4 100644
--- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
@@ -654,25 +654,11 @@ static inline void abx500_gpio_dbg_show_one(struct seq_file *s,
 #define abx500_gpio_dbg_show	NULL
 #endif
 
-static int abx500_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	return pinctrl_request_gpio(gpio);
-}
-
-static void abx500_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	pinctrl_free_gpio(gpio);
-}
-
 static struct gpio_chip abx500gpio_chip = {
 	.label			= "abx500-gpio",
 	.owner			= THIS_MODULE,
-	.request		= abx500_gpio_request,
-	.free			= abx500_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.direction_input	= abx500_gpio_direction_input,
 	.get			= abx500_gpio_get,
 	.direction_output	= abx500_gpio_direction_output,
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index 96cf039..eebfae0 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -884,24 +884,6 @@ static void nmk_gpio_latent_irq_handler(struct irq_desc *desc)
 
 /* I/O Functions */
 
-static int nmk_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	/*
-	 * Map back to global GPIO space and request muxing, the direction
-	 * parameter does not matter for this controller.
-	 */
-	int gpio = chip->base + offset;
-
-	return pinctrl_request_gpio(gpio);
-}
-
-static void nmk_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	pinctrl_free_gpio(gpio);
-}
-
 static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
 {
 	struct nmk_gpio_chip *nmk_chip =
@@ -1267,8 +1249,8 @@ static int nmk_gpio_probe(struct platform_device *dev)
 	spin_lock_init(&nmk_chip->lock);
 
 	chip = &nmk_chip->chip;
-	chip->request = nmk_gpio_request;
-	chip->free = nmk_gpio_free;
+	chip->request = gpiochip_generic_request;
+	chip->free = gpiochip_generic_free;
 	chip->direction_input = nmk_gpio_make_input;
 	chip->get = nmk_gpio_get_input;
 	chip->direction_output = nmk_gpio_make_output;
diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index f6be685..fd342df 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -713,16 +713,6 @@ static struct pinctrl_desc adi_pinmux_desc = {
 	.owner = THIS_MODULE,
 };
 
-static int adi_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void adi_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
 	struct gpio_port *port;
@@ -994,8 +984,8 @@ static int adi_gpio_probe(struct platform_device *pdev)
 	port->chip.get			= adi_gpio_get_value;
 	port->chip.direction_output	= adi_gpio_direction_output;
 	port->chip.set			= adi_gpio_set_value;
-	port->chip.request		= adi_gpio_request;
-	port->chip.free			= adi_gpio_free;
+	port->chip.request		= gpiochip_generic_request,
+	port->chip.free			= gpiochip_generic_free,
 	port->chip.to_irq		= adi_gpio_to_irq;
 	if (pdata->port_gpio_base > 0)
 		port->chip.base		= pdata->port_gpio_base;
diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 4747e08..56af28b 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -536,21 +536,11 @@ static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	return as3722_irq_get_virq(as_pci->as3722, offset);
 }
 
-static int as3722_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void as3722_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static const struct gpio_chip as3722_gpio_chip = {
 	.label			= "as3722-gpio",
 	.owner			= THIS_MODULE,
-	.request		= as3722_gpio_request,
-	.free			= as3722_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.get			= as3722_gpio_get,
 	.set			= as3722_gpio_set,
 	.direction_input	= as3722_gpio_direction_input,
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index b0fde0f..ce6e589 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1277,28 +1277,6 @@ static int at91_pinctrl_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int at91_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	/*
-	 * Map back to global GPIO space and request muxing, the direction
-	 * parameter does not matter for this controller.
-	 */
-	int gpio = chip->base + offset;
-	int bank = chip->base / chip->ngpio;
-
-	dev_dbg(chip->dev, "%s:%d pio%c%d(%d)\n", __func__, __LINE__,
-		 'A' + bank, offset, gpio);
-
-	return pinctrl_request_gpio(gpio);
-}
-
-static void at91_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	pinctrl_free_gpio(gpio);
-}
-
 static int at91_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 {
 	struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
@@ -1684,8 +1662,8 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
 
 /* This structure is replicated for each GPIO block allocated at probe time */
 static struct gpio_chip at91_gpio_template = {
-	.request		= at91_gpio_request,
-	.free			= at91_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.get_direction		= at91_gpio_get_direction,
 	.direction_input	= at91_gpio_direction_input,
 	.get			= at91_gpio_get,
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 9c9b889..813eb7c 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -217,24 +217,6 @@ static inline struct u300_gpio *to_u300_gpio(struct gpio_chip *chip)
 	return container_of(chip, struct u300_gpio, chip);
 }
 
-static int u300_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	/*
-	 * Map back to global GPIO space and request muxing, the direction
-	 * parameter does not matter for this controller.
-	 */
-	int gpio = chip->base + offset;
-
-	return pinctrl_request_gpio(gpio);
-}
-
-static void u300_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	pinctrl_free_gpio(gpio);
-}
-
 static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct u300_gpio *gpio = to_u300_gpio(chip);
@@ -417,8 +399,8 @@ int u300_gpio_config_set(struct gpio_chip *chip, unsigned offset,
 static struct gpio_chip u300_gpio_chip = {
 	.label			= "u300-gpio-chip",
 	.owner			= THIS_MODULE,
-	.request		= u300_gpio_request,
-	.free			= u300_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.get			= u300_gpio_get,
 	.set			= u300_gpio_set,
 	.direction_input	= u300_gpio_direction_input,
diff --git a/drivers/pinctrl/pinctrl-digicolor.c b/drivers/pinctrl/pinctrl-digicolor.c
index 11f8b83..38a7799 100644
--- a/drivers/pinctrl/pinctrl-digicolor.c
+++ b/drivers/pinctrl/pinctrl-digicolor.c
@@ -169,16 +169,6 @@ static struct pinmux_ops dc_pmxops = {
 	.gpio_request_enable	= dc_pmx_request_gpio,
 };
 
-static int dc_gpio_request(struct gpio_chip *chip, unsigned gpio)
-{
-	return pinctrl_request_gpio(chip->base + gpio);
-}
-
-static void dc_gpio_free(struct gpio_chip *chip, unsigned gpio)
-{
-	pinctrl_free_gpio(chip->base + gpio);
-}
-
 static int dc_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 {
 	struct dc_pinmap *pmap = container_of(chip, struct dc_pinmap, chip);
@@ -255,8 +245,8 @@ static int dc_gpiochip_add(struct dc_pinmap *pmap, struct device_node *np)
 
 	chip->label		= DRIVER_NAME;
 	chip->dev		= pmap->dev;
-	chip->request		= dc_gpio_request;
-	chip->free		= dc_gpio_free;
+	chip->request		= gpiochip_generic_request;
+	chip->free		= gpiochip_generic_free;
 	chip->direction_input	= dc_gpio_direction_input;
 	chip->direction_output	= dc_gpio_direction_output;
 	chip->get		= dc_gpio_get;
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index 952b1c6..85c9046 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1171,16 +1171,6 @@ static struct pinctrl_desc pistachio_pinctrl_desc = {
 	.confops = &pistachio_pinconf_ops,
 };
 
-static int pistachio_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void pistachio_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int pistachio_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 {
 	struct pistachio_gpio_bank *bank = gc_to_bank(chip);
@@ -1332,8 +1322,8 @@ static void pistachio_gpio_irq_handler(struct irq_desc *desc)
 		.npins = _npins,					\
 		.gpio_chip = {						\
 			.label = "GPIO" #_bank,				\
-			.request = pistachio_gpio_request,		\
-			.free = pistachio_gpio_free,			\
+			.request = gpiochip_generic_request,		\
+			.free = gpiochip_generic_free,			\
 			.get_direction = pistachio_gpio_get_direction,	\
 			.direction_input = pistachio_gpio_direction_input, \
 			.direction_output = pistachio_gpio_direction_output, \
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 88bb707..d79889a 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -1374,16 +1374,6 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
  * GPIO handling
  */
 
-static int rockchip_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void rockchip_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
 {
 	struct rockchip_pin_bank *bank = gc_to_pin_bank(gc);
@@ -1461,8 +1451,8 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
 }
 
 static const struct gpio_chip rockchip_gpiolib_chip = {
-	.request = rockchip_gpio_request,
-	.free = rockchip_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.set = rockchip_gpio_set,
 	.get = rockchip_gpio_get,
 	.direction_input = rockchip_gpio_direction_input,
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 389526e..b58d3f2 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -742,16 +742,6 @@ static void st_gpio_direction(struct st_gpio_bank *bank,
 	}
 }
 
-static int st_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void st_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int st_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct st_gpio_bank *bank = gpio_chip_to_bank(chip);
@@ -1490,8 +1480,8 @@ static void st_gpio_irqmux_handler(struct irq_desc *desc)
 }
 
 static struct gpio_chip st_gpio_template = {
-	.request		= st_gpio_request,
-	.free			= st_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.get			= st_gpio_get,
 	.set			= st_gpio_set,
 	.direction_input	= st_gpio_direction_input,
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 779950c..ae724bd 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -682,28 +682,14 @@ static int xway_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, int val)
 	return 0;
 }
 
-static int xway_gpio_req(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	return pinctrl_request_gpio(gpio);
-}
-
-static void xway_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-
-	pinctrl_free_gpio(gpio);
-}
-
 static struct gpio_chip xway_chip = {
 	.label = "gpio-xway",
 	.direction_input = xway_gpio_dir_in,
 	.direction_output = xway_gpio_dir_out,
 	.get = xway_gpio_get,
 	.set = xway_gpio_set,
-	.request = xway_gpio_req,
-	.free = xway_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.base = -1,
 };
 
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index a0c7407..146264a 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -458,18 +458,6 @@ static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	spin_unlock_irqrestore(&pctrl->lock, flags);
 }
 
-static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-	return pinctrl_request_gpio(gpio);
-}
-
-static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	int gpio = chip->base + offset;
-	return pinctrl_free_gpio(gpio);
-}
-
 #ifdef CONFIG_DEBUG_FS
 #include <linux/seq_file.h>
 
@@ -527,8 +515,8 @@ static struct gpio_chip msm_gpio_template = {
 	.direction_output = msm_gpio_direction_output,
 	.get              = msm_gpio_get,
 	.set              = msm_gpio_set,
-	.request          = msm_gpio_request,
-	.free             = msm_gpio_free,
+	.request          = gpiochip_generic_request,
+	.free             = gpiochip_generic_free,
 	.dbg_show         = msm_gpio_dbg_show,
 };
 
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index bd1e245..6c42ca1 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -546,16 +546,6 @@ static void pmic_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
 	pmic_gpio_config_set(state->ctrl, pin, &config, 1);
 }
 
-static int pmic_gpio_request(struct gpio_chip *chip, unsigned base)
-{
-	return pinctrl_request_gpio(chip->base + base);
-}
-
-static void pmic_gpio_free(struct gpio_chip *chip, unsigned base)
-{
-	pinctrl_free_gpio(chip->base + base);
-}
-
 static int pmic_gpio_of_xlate(struct gpio_chip *chip,
 			      const struct of_phandle_args *gpio_desc,
 			      u32 *flags)
@@ -595,8 +585,8 @@ static const struct gpio_chip pmic_gpio_gpio_template = {
 	.direction_output	= pmic_gpio_direction_output,
 	.get			= pmic_gpio_get,
 	.set			= pmic_gpio_set,
-	.request		= pmic_gpio_request,
-	.free			= pmic_gpio_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.of_xlate		= pmic_gpio_of_xlate,
 	.to_irq			= pmic_gpio_to_irq,
 	.dbg_show		= pmic_gpio_dbg_show,
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
index e3be3ce..9ce0e30 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
@@ -604,16 +604,6 @@ static void pmic_mpp_set(struct gpio_chip *chip, unsigned pin, int value)
 	pmic_mpp_config_set(state->ctrl, pin, &config, 1);
 }
 
-static int pmic_mpp_request(struct gpio_chip *chip, unsigned base)
-{
-	return pinctrl_request_gpio(chip->base + base);
-}
-
-static void pmic_mpp_free(struct gpio_chip *chip, unsigned base)
-{
-	pinctrl_free_gpio(chip->base + base);
-}
-
 static int pmic_mpp_of_xlate(struct gpio_chip *chip,
 			     const struct of_phandle_args *gpio_desc,
 			     u32 *flags)
@@ -653,8 +643,8 @@ static const struct gpio_chip pmic_mpp_gpio_template = {
 	.direction_output	= pmic_mpp_direction_output,
 	.get			= pmic_mpp_get,
 	.set			= pmic_mpp_set,
-	.request		= pmic_mpp_request,
-	.free			= pmic_mpp_free,
+	.request		= gpiochip_generic_request,
+	.free			= gpiochip_generic_free,
 	.of_xlate		= pmic_mpp_of_xlate,
 	.to_irq			= pmic_mpp_to_irq,
 	.dbg_show		= pmic_mpp_dbg_show,
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index c760bf4..3f622cc 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -888,19 +888,9 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
 	return 0;
 }
 
-static int samsung_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void samsung_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static const struct gpio_chip samsung_gpiolib_chip = {
-	.request = samsung_gpio_request,
-	.free = samsung_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.set = samsung_gpio_set,
 	.get = samsung_gpio_get,
 	.direction_input = samsung_gpio_direction_input,
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 38e0c7b..f9c7a05 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -446,16 +446,6 @@ static const struct pinmux_ops sunxi_pmx_ops = {
 	.gpio_set_direction	= sunxi_pmx_gpio_set_direction,
 };
 
-static int sunxi_pinctrl_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void sunxi_pinctrl_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
 					unsigned offset)
 {
@@ -956,8 +946,8 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
 
 	last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number;
 	pctl->chip->owner = THIS_MODULE;
-	pctl->chip->request = sunxi_pinctrl_gpio_request,
-	pctl->chip->free = sunxi_pinctrl_gpio_free,
+	pctl->chip->request = gpiochip_generic_request,
+	pctl->chip->free = gpiochip_generic_free,
 	pctl->chip->direction_input = sunxi_pinctrl_gpio_direction_input,
 	pctl->chip->direction_output = sunxi_pinctrl_gpio_direction_output,
 	pctl->chip->get = sunxi_pinctrl_gpio_get,
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index c15316b..fb22d3f 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -486,16 +486,6 @@ static struct pinctrl_desc wmt_desc = {
 	.confops = &wmt_pinconf_ops,
 };
 
-static int wmt_gpio_request(struct gpio_chip *chip, unsigned offset)
-{
-	return pinctrl_request_gpio(chip->base + offset);
-}
-
-static void wmt_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
-	pinctrl_free_gpio(chip->base + offset);
-}
-
 static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 {
 	struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev);
@@ -560,8 +550,8 @@ static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 static struct gpio_chip wmt_gpio_chip = {
 	.label = "gpio-wmt",
 	.owner = THIS_MODULE,
-	.request = wmt_gpio_request,
-	.free = wmt_gpio_free,
+	.request = gpiochip_generic_request,
+	.free = gpiochip_generic_free,
 	.get_direction = wmt_gpio_get_direction,
 	.direction_input = wmt_gpio_direction_input,
 	.direction_output = wmt_gpio_direction_output,
-- 
2.1.4

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

* Re: [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free
  2015-10-11 15:34 ` [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free Jonas Gorski
@ 2015-10-11 15:43   ` Maxime Ripard
  2015-10-16 20:20   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2015-10-11 15:43 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Linus Walleij, Alexandre Courbot, Joachim Eastwood,
	Jonas Jensen, Gregory CLEMENT, Thomas Petazzoni, James Hogan,
	Stefan Agner, Jun Nie, Stephen Warren, Lee Jones, Eric Anholt,
	Mika Westerberg, Heikki Krogerus, Matthias Brugger,
	Alessandro Rubini, Sonic Zhang, Laxman Dewangan,
	Jean-Christophe Plagniol-Villard, Baruch Siach,
	Andrew Bresticker

[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]

On Sun, Oct 11, 2015 at 05:34:19PM +0200, Jonas Gorski wrote:
> Replace all trivial request/free callbacks that do nothing but call into
> pinctrl code with the generic versions.
> 
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> Acked-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Eric Anholt <eric@anholt.net>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Andrew Bresticker <abrestic@chromium.org>
> Acked-by: Baruch Siach <baruch@tkos.co.il>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Acked-by: Lee Jones <lee@kernel.org>
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> ---
>  drivers/pinctrl/bcm/pinctrl-bcm2835.c         | 14 ++------------
>  drivers/pinctrl/intel/pinctrl-cherryview.c    | 14 ++------------
>  drivers/pinctrl/intel/pinctrl-intel.c         | 14 ++------------
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++------------
>  drivers/pinctrl/nomadik/pinctrl-abx500.c      | 18 ++----------------
>  drivers/pinctrl/nomadik/pinctrl-nomadik.c     | 22 ++--------------------
>  drivers/pinctrl/pinctrl-adi2.c                | 14 ++------------
>  drivers/pinctrl/pinctrl-as3722.c              | 14 ++------------
>  drivers/pinctrl/pinctrl-at91.c                | 26 ++------------------------
>  drivers/pinctrl/pinctrl-coh901.c              | 22 ++--------------------
>  drivers/pinctrl/pinctrl-digicolor.c           | 14 ++------------
>  drivers/pinctrl/pinctrl-pistachio.c           | 14 ++------------
>  drivers/pinctrl/pinctrl-rockchip.c            | 14 ++------------
>  drivers/pinctrl/pinctrl-st.c                  | 14 ++------------
>  drivers/pinctrl/pinctrl-xway.c                | 18 ++----------------
>  drivers/pinctrl/qcom/pinctrl-msm.c            | 16 ++--------------
>  drivers/pinctrl/qcom/pinctrl-spmi-gpio.c      | 14 ++------------
>  drivers/pinctrl/qcom/pinctrl-spmi-mpp.c       | 14 ++------------
>  drivers/pinctrl/samsung/pinctrl-samsung.c     | 14 ++------------
>  drivers/pinctrl/sunxi/pinctrl-sunxi.c         | 14 ++------------

For sunxi,

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one
  2015-10-11 15:34 ` [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one Jonas Gorski
@ 2015-10-12 13:08   ` Gregory CLEMENT
  2015-10-16 20:14   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2015-10-12 13:08 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Linus Walleij, Alexandre Courbot, Joachim Eastwood,
	Jonas Jensen, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker, Heiko Stuebner, Sriniv

Hi Jonas,
 
 On dim., oct. 11 2015, Jonas Gorski <jogo@openwrt.org> wrote:

> Replace all trivial request/free callbacks that do nothing but call into
> pinctrl code with the generic versions.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Acked-by: James Hogan <james.hogan@imgtec.com>
> Acked-by: Stefan Agner <stefan@agner.ch>
> Acked-by: Joachim Eastwood <manabian@gmail.com>
> ---
>  drivers/gpio/gpio-lpc18xx.c    | 14 ++------------
>  drivers/gpio/gpio-moxart.c     | 14 ++------------
>  drivers/gpio/gpio-mvebu.c      | 14 ++------------

For mvebu:

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Thanks,

Gregory

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH V2 1/5] gpiolib: provide generic request/free implementations
  2015-10-11 15:34 ` [PATCH V2 1/5] gpiolib: provide generic request/free implementations Jonas Gorski
@ 2015-10-16 20:11   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2015-10-16 20:11 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker

On Sun, Oct 11, 2015 at 5:34 PM, Jonas Gorski <jogo@openwrt.org> wrote:

> Provide generic request/free implementations that pinctrl aware gpio
> drivers can use instead of open coding if they use a 1:1 pin to gpio
> signal mapping.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> ---
> RFC -> V2:
>  * renamed gpio to offset

Patch applied, thanks.

Yours,
Linus Walleij

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

* Re: [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one
  2015-10-11 15:34 ` [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one Jonas Gorski
  2015-10-12 13:08   ` Gregory CLEMENT
@ 2015-10-16 20:14   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2015-10-16 20:14 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker

On Sun, Oct 11, 2015 at 5:34 PM, Jonas Gorski <jogo@openwrt.org> wrote:

> Replace all trivial request/free callbacks that do nothing but call into
> pinctrl code with the generic versions.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Acked-by: James Hogan <james.hogan@imgtec.com>
> Acked-by: Stefan Agner <stefan@agner.ch>
> Acked-by: Joachim Eastwood <manabian@gmail.com>

Patch applied (also added Gregory's ACK).

Yours,
Linus Walleij

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

* Re: [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations
  2015-10-11 15:34 ` [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations Jonas Gorski
@ 2015-10-16 20:16   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2015-10-16 20:16 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker

On Sun, Oct 11, 2015 at 5:34 PM, Jonas Gorski <jogo@openwrt.org> wrote:

> Instead of storing in the chip data whether the chip uses pinctrl and
> conditionally call pinctrl_{request,free}_gpio, just don't populate
> request/free in that case.
>
> This makes the implementations trivial and the same as the generic
> implementations, thus we can just use them.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH V2 4/5] gpio: gpio-pl061: use the generic request/free implementations
  2015-10-11 15:34 ` [PATCH V2 4/5] gpio: gpio-pl061: " Jonas Gorski
@ 2015-10-16 20:17   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2015-10-16 20:17 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker

On Sun, Oct 11, 2015 at 5:34 PM, Jonas Gorski <jogo@openwrt.org> wrote:

> Instead of storing in the chip data whether the chip uses pinctrl and
> conditionally call pinctrl_{request,free}_gpio, just don't populate
> request/free in that case.
>
> This makes the implementations trivial and the same as the generic
> implementations, thus we can just use them.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free
  2015-10-11 15:34 ` [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free Jonas Gorski
  2015-10-11 15:43   ` Maxime Ripard
@ 2015-10-16 20:20   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2015-10-16 20:20 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-gpio, Alexandre Courbot, Joachim Eastwood, Jonas Jensen,
	Gregory CLEMENT, Thomas Petazzoni, James Hogan, Stefan Agner,
	Jun Nie, Stephen Warren, Lee Jones, Eric Anholt, Mika Westerberg,
	Heikki Krogerus, Matthias Brugger, Alessandro Rubini,
	Sonic Zhang, Laxman Dewangan, Jean-Christophe Plagniol-Villard,
	Baruch Siach, Andrew Bresticker

On Sun, Oct 11, 2015 at 5:34 PM, Jonas Gorski <jogo@openwrt.org> wrote:

> Replace all trivial request/free callbacks that do nothing but call into
> pinctrl code with the generic versions.
>
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> Acked-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Eric Anholt <eric@anholt.net>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Acked-by: Andrew Bresticker <abrestic@chromium.org>
> Acked-by: Baruch Siach <baruch@tkos.co.il>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Acked-by: Lee Jones <lee@kernel.org>
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

Patch applied, also added Maxime's ACK.

Now I hope this does not collide with pinctrl in linux-next.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-10-16 20:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-11 15:34 [PATCH V2 0/5] gpiochip: add and use generic request/free Jonas Gorski
2015-10-11 15:34 ` [PATCH V2 1/5] gpiolib: provide generic request/free implementations Jonas Gorski
2015-10-16 20:11   ` Linus Walleij
2015-10-11 15:34 ` [PATCH V2 2/5] gpio: replace trivial implementations of request/free with generic one Jonas Gorski
2015-10-12 13:08   ` Gregory CLEMENT
2015-10-16 20:14   ` Linus Walleij
2015-10-11 15:34 ` [PATCH V2 3/5] gpio: gpio-xz: use the generic request/free implementations Jonas Gorski
2015-10-16 20:16   ` Linus Walleij
2015-10-11 15:34 ` [PATCH V2 4/5] gpio: gpio-pl061: " Jonas Gorski
2015-10-16 20:17   ` Linus Walleij
2015-10-11 15:34 ` [PATCH V2 5/5] pinctrl: replace trivial implementations of gpio_chip request/free Jonas Gorski
2015-10-11 15:43   ` Maxime Ripard
2015-10-16 20:20   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.