A lot of pinctrl aware gpio chip drivers use the following pattern: int foo_request_gpio(struct gpio_chip *gc, unsigned gpio) { return pinctrl_request_gpio(gc->base + gpio); } void foo_request_gpio(struct gpio_chip *gc, unsigned gpio) { pinctrl_free_gpio(gc->base + gpio); } 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, therefore RFT. Patches apply cleanly to 4.3-rc1 as well as linux-gpio/for-next. 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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html