summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-generic.c
diff options
context:
space:
mode:
authorAnthony Fee <anthony.fee@emutex.com>2014-05-19 21:49:14 +0400
committerLinus Walleij <linus.walleij@linaro.org>2014-05-23 16:31:51 +0400
commit7b42e3dbdafcc0454ffbce0a88b6d3f456e70d85 (patch)
tree9d98ea0ecc17bf63c1a2d7307b9d07d95a6ba00d /drivers/gpio/gpio-generic.c
parent3ff35cbcfa4bc7d7dbdd0279e32ea677567ded02 (diff)
downloadlinux-7b42e3dbdafcc0454ffbce0a88b6d3f456e70d85.tar.xz
gpio: generic: add request function pointer
gpiolib will require all gpio drivers to expicitly set the request function pointer in the future. To encourage gpio driver developers to adhere to this standard gpio-generic.c now sets this function pointer. Signed-off-by: Anthony Fee <anthony.fee@emutex.com> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-generic.c')
-rw-r--r--drivers/gpio/gpio-generic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index b5dff9e742f8..fea8c82bb8fc 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -388,6 +388,14 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc,
return 0;
}
+static int bgpio_request(struct gpio_chip *chip, unsigned gpio_pin)
+{
+ if (gpio_pin < chip->ngpio)
+ return 0;
+
+ return -EINVAL;
+}
+
int bgpio_remove(struct bgpio_chip *bgc)
{
return gpiochip_remove(&bgc->gc);
@@ -413,6 +421,7 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
bgc->gc.label = dev_name(dev);
bgc->gc.base = -1;
bgc->gc.ngpio = bgc->bits;
+ bgc->gc.request = bgpio_request;
ret = bgpio_setup_io(bgc, dat, set, clr);
if (ret)