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

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.