summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2016-03-29 10:04:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-20 15:45:20 +0900
commit378219c76f7d9fe4cded8382b955cb8e82963705 (patch)
tree1686361855ac187745993e234230d4e152084856
parenta83977c7662d4410f6da7ffd1ff0d7725d7d2759 (diff)
downloadlwn-378219c76f7d9fe4cded8382b955cb8e82963705.tar.gz
lwn-378219c76f7d9fe4cded8382b955cb8e82963705.zip
gpio: pxa: fix legacy non pinctrl aware builds
commit c4e5ffb6f224c1a4a9eaad82b19645ec22d1b24f upstream. In legacy pxa builds, ie. non device-tree and platform-data only builds, pinctrl is not yet available. As a consequence, the pinctrl gpio direction change function is a stub, returning always success. In the current state, the gpio driver direction function believes the pinctrl direction change was successful, and exits without actually changing the gpio direction. This patch changes the logic : - if the pinctrl direction function fails, gpio direction will report that failure - if the pinctrl direction function succeeds, gpio direction is changed by the gpio driver anyway. This is sub optimal in the pinctrl aware case, as the gpio direction will be changed twice: once by pinctrl function and another time by the gpio direction function. Yet it should be acceptable in this form, as this is functional for all pxa platforms (device-tree and platform-data), and moreover changing a gpio direction is very very seldom, usually in machine initialization, seldom in drivers probe, and an exception for ac97 reset bug. Fixes: a770d946371e ("gpio: pxa: add pin control gpio direction and request") Reported-by: Guenter Roeck <guenter@roeck-us.net> Tested-by: Guenter Roeck <guenter@roeck-us.net> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpio/gpio-pxa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index b2b7b78664b8..76ac906b4d78 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -283,8 +283,8 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
ret = pinctrl_gpio_direction_output(chip->base + offset);
- if (!ret)
- return 0;
+ if (ret)
+ return ret;
spin_lock_irqsave(&gpio_lock, flags);