aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tps65218.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-02-16 15:41:42 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-02-16 15:41:42 +0100
commit143b65d677a59764e438d457bf2510b3fa5b90f8 (patch)
tree586c063e5cf8960fe39b481436a26f961f7fb44f /drivers/gpio/gpio-tps65218.c
parentgpio: davinci: Fix possible NULL pointer deference (diff)
downloadlinux-dev-143b65d677a59764e438d457bf2510b3fa5b90f8.tar.xz
linux-dev-143b65d677a59764e438d457bf2510b3fa5b90f8.zip
gpio: create an API to detect open drain/source on lines
My left hand merges code to privatize the descriptor handling while my right hand merges drivers that poke around and disrespect with the same gpiolib internals. So let's expose the proper APIs for drivers to ask the gpiolib core if a line is marked as open drain or open source and get some order around things so this driver compiles again. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-tps65218.c')
-rw-r--r--drivers/gpio/gpio-tps65218.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-tps65218.c b/drivers/gpio/gpio-tps65218.c
index 7b02f7be9bc9..9eb1a5ab2d95 100644
--- a/drivers/gpio/gpio-tps65218.c
+++ b/drivers/gpio/gpio-tps65218.c
@@ -71,17 +71,16 @@ static int tps65218_gpio_request(struct gpio_chip *gc, unsigned offset)
{
struct tps65218_gpio *tps65218_gpio = gpiochip_get_data(gc);
struct tps65218 *tps65218 = tps65218_gpio->tps65218;
- unsigned long flags = gc->desc[offset].flags;
int ret;
- if (flags & FLAG_OPEN_SOURCE) {
+ if (gpiochip_line_is_open_source(gc, offset)) {
dev_err(gc->parent, "can't work as open source\n");
return -EINVAL;
}
switch (offset) {
case 0:
- if (!(flags & FLAG_OPEN_DRAIN)) {
+ if (!gpiochip_line_is_open_drain(gc, offset)) {
dev_err(gc->parent, "GPO1 works only as open drain\n");
return -EINVAL;
}
@@ -103,7 +102,7 @@ static int tps65218_gpio_request(struct gpio_chip *gc, unsigned offset)
break;
case 1:
/* GP02 is push-pull by default, can be set as open drain. */
- if (flags & FLAG_OPEN_DRAIN) {
+ if (gpiochip_line_is_open_drain(gc, offset)) {
ret = tps65218_clear_bits(tps65218,
TPS65218_REG_CONFIG1,
TPS65218_CONFIG1_GPO2_BUF,
@@ -122,7 +121,7 @@ static int tps65218_gpio_request(struct gpio_chip *gc, unsigned offset)
break;
case 2:
- if (!(flags & FLAG_OPEN_DRAIN)) {
+ if (!gpiochip_line_is_open_drain(gc, offset)) {
dev_err(gc->parent, "GPO3 works only as open drain\n");
return -EINVAL;
}