Commit 7b42e3db authored by Anthony Fee's avatar Anthony Fee Committed by Linus Walleij

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: default avatarAnthony Fee <anthony.fee@emutex.com>
Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3ff35cbc
...@@ -388,6 +388,14 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc, ...@@ -388,6 +388,14 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc,
return 0; 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) int bgpio_remove(struct bgpio_chip *bgc)
{ {
return gpiochip_remove(&bgc->gc); return gpiochip_remove(&bgc->gc);
...@@ -413,6 +421,7 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev, ...@@ -413,6 +421,7 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
bgc->gc.label = dev_name(dev); bgc->gc.label = dev_name(dev);
bgc->gc.base = -1; bgc->gc.base = -1;
bgc->gc.ngpio = bgc->bits; bgc->gc.ngpio = bgc->bits;
bgc->gc.request = bgpio_request;
ret = bgpio_setup_io(bgc, dat, set, clr); ret = bgpio_setup_io(bgc, dat, set, clr);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment