diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-02-22 02:22:52 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-03-08 22:41:23 -0500 |
commit | fa4007ca06e4c808b002067c2ea02a9bebdc044b (patch) | |
tree | 3423b11e0375a5a398890031ecb048737a536eb8 | |
parent | 28c5a41e4aa44f162297d596030900b90aa1cf08 (diff) |
gpio: mpc8xxx: Fixup setting gpio direction output
For devtype with specific gpio_dir_out implementation, current code is
wrong because below code sets both gc->direction_output and
mpc8xxx_gc->direction_output to the same function.
gc->direction_output = devtype->gpio_dir_out ?: gc->direction_output;
mpc8xxx_gc->direction_output = gc->direction_output;
Set mpc8xxx_gc->direction_output = gc->direction_output first to fix it.
This way mpc8xxx_gc->direction_output actually calls the standard
bgpio_dir_out() to update register.
Fixes: commit 42178e2a1e42 ("drivers/gpio: Switch gpio-mpc8xxx to use gpio-generic")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-mpc8xxx.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index ecdb27ad9f1b..d2472c5dfe6f 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -334,6 +334,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) | |||
334 | 334 | ||
335 | mpc8xxx_gc->read_reg = gc->read_reg; | 335 | mpc8xxx_gc->read_reg = gc->read_reg; |
336 | mpc8xxx_gc->write_reg = gc->write_reg; | 336 | mpc8xxx_gc->write_reg = gc->write_reg; |
337 | mpc8xxx_gc->direction_output = gc->direction_output; | ||
337 | 338 | ||
338 | if (!devtype) | 339 | if (!devtype) |
339 | devtype = &mpc8xxx_gpio_devtype_default; | 340 | devtype = &mpc8xxx_gpio_devtype_default; |
@@ -348,8 +349,6 @@ static int mpc8xxx_probe(struct platform_device *pdev) | |||
348 | gc->get = devtype->gpio_get ?: gc->get; | 349 | gc->get = devtype->gpio_get ?: gc->get; |
349 | gc->to_irq = mpc8xxx_gpio_to_irq; | 350 | gc->to_irq = mpc8xxx_gpio_to_irq; |
350 | 351 | ||
351 | mpc8xxx_gc->direction_output = gc->direction_output; | ||
352 | |||
353 | ret = gpiochip_add_data(gc, mpc8xxx_gc); | 352 | ret = gpiochip_add_data(gc, mpc8xxx_gc); |
354 | if (ret) { | 353 | if (ret) { |
355 | pr_err("%s: GPIO chip registration failed with status %d\n", | 354 | pr_err("%s: GPIO chip registration failed with status %d\n", |