Skip to content

gpiochip: add and use generic request/free

Jonas Gorski linux-gpio 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 7 repliesIn review
  2. v15 patches 17 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5gpiolib: provide generic request/free implementationsdrivers/gpio/gpiolib.c include/linux/gpio/driver.h+26 -01 reply
2/5gpio: replace trivial implementations of request/free with generic onedrivers/gpio/gpio-lpc18xx.c drivers/gpio/gpio-moxart.c drivers/gpio/gpio-mvebu.c +3 more+12 -722 replies
3/5gpio: gpio-xz: use the generic request/free implementationsdrivers/gpio/gpio-zx.c+4 -241 reply
4/5gpio: gpio-pl061: use the generic request/free implementationsdrivers/gpio/gpio-pl061.c+4 -281 reply
5/5pinctrl: replace trivial implementations of gpio_chip request/freedrivers/pinctrl/bcm/pinctrl-bcm2835.c drivers/pinctrl/intel/pinctrl-cherryview.c drivers/pinctrl/intel/pinctrl-intel.c +18 more+42 -2902 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchThomas PetazzoniJames HoganStefan AgnerJoachim EastwoodBjorn AnderssonHeiko StuebnerEric AnholtMika WesterbergAndrew BrestickerBaruch SiachMatthias BruggerLee JonesLaxman DewanganMaxime RipardGregory CLEMENT
1/5
2/5R-b A-b A-b A-b A-b
3/5
4/5
5/5A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 15 reviewers.

Read the v2 thread

Cover letter [PATCH V2 0/5] gpiochip: add and use generic request/free

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(-)
Signature · 1 line
2.1.4