All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFT][PATCH v2 1/3] gpio: mpc8xxx: Fixup setting gpio direction output
@ 2016-02-22  7:22 Axel Lin
  2016-02-22  7:24 ` [RFT][PATCH v2 2/3] gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip Axel Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Axel Lin @ 2016-02-22  7:22 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Liu Gang, Alexandre Courbot, Ricardo Ribalda Delgado,
	Alexander Stein, linux-gpio

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>
---
 drivers/gpio/gpio-mpc8xxx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ecdb27a..d2472c5 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)
 
 	mpc8xxx_gc->read_reg = gc->read_reg;
 	mpc8xxx_gc->write_reg = gc->write_reg;
+	mpc8xxx_gc->direction_output = gc->direction_output;
 
 	if (!devtype)
 		devtype = &mpc8xxx_gpio_devtype_default;
@@ -348,8 +349,6 @@ static int mpc8xxx_probe(struct platform_device *pdev)
 	gc->get = devtype->gpio_get ?: gc->get;
 	gc->to_irq = mpc8xxx_gpio_to_irq;
 
-	mpc8xxx_gc->direction_output = gc->direction_output;
-
 	ret = gpiochip_add_data(gc, mpc8xxx_gc);
 	if (ret) {
 		pr_err("%s: GPIO chip registration failed with status %d\n",
-- 
2.1.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-09  3:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22  7:22 [RFT][PATCH v2 1/3] gpio: mpc8xxx: Fixup setting gpio direction output Axel Lin
2016-02-22  7:24 ` [RFT][PATCH v2 2/3] gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip Axel Lin
2016-03-02  7:31   ` Gang Liu
2016-03-09  3:43   ` Linus Walleij
2016-02-22  7:24 ` [RFT][PATCH v2 3/3] gpio: mpc8xxx: Slightly update the code for better readability Axel Lin
2016-03-02  7:32   ` Gang Liu
2016-03-09  3:44   ` Linus Walleij
2016-03-02  7:20 ` [RFT][PATCH v2 1/3] gpio: mpc8xxx: Fixup setting gpio direction output Gang Liu
2016-03-09  3:42 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.