[PATCH] gpio: gpio-kempld: Fix get_direction return value

Subsystems: gpio subsystem, the rest

STALE4181d

3 messages, 3 authors, 2015-05-12 · open the first message on its own page

[PATCH] gpio: gpio-kempld: Fix get_direction return value

From: Michael Brunner <hidden>
Date: 2015-05-11 10:47:05

This patch fixes an inverted return value of the gpio get_direction
function.

The wrong value causes the direction sysfs entry and GPIO debugfs file
to indicate incorrect GPIO direction settings. In some cases it also
prevents setting GPIO output values.

The problem is also present in all other stable kernel versions since
linux-3.12.

Reported-by: Jochen Henneberg <redacted>
Signed-off-by: Michael Brunner <redacted>
---
 drivers/gpio/gpio-kempld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c
index 6b8115f..83f281d 100644
--- a/drivers/gpio/gpio-kempld.c
+++ b/drivers/gpio/gpio-kempld.c
@@ -117,7 +117,7 @@ static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 		= container_of(chip, struct kempld_gpio_data, chip);
 	struct kempld_device_data *pld = gpio->pld;
 
-	return kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset);
+	return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset);
 }
 
 static int kempld_gpio_pincount(struct kempld_device_data *pld)
-- 
1.8.5.1

Re: [PATCH] gpio: gpio-kempld: Fix get_direction return value

From: Guenter Roeck <linux@roeck-us.net>
Date: 2015-05-11 13:09:10

On Mon, May 11, 2015 at 12:46:49PM +0200, Michael Brunner wrote:
This patch fixes an inverted return value of the gpio get_direction
function.

The wrong value causes the direction sysfs entry and GPIO debugfs file
to indicate incorrect GPIO direction settings. In some cases it also
prevents setting GPIO output values.

The problem is also present in all other stable kernel versions since
linux-3.12.

Reported-by: Jochen Henneberg <redacted>
Signed-off-by: Michael Brunner <redacted>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Re: [PATCH] gpio: gpio-kempld: Fix get_direction return value

From: Linus Walleij <hidden>
Date: 2015-05-12 11:50:30

On Mon, May 11, 2015 at 12:46 PM, Michael Brunner [off-list ref] wrote:
This patch fixes an inverted return value of the gpio get_direction
function.

The wrong value causes the direction sysfs entry and GPIO debugfs file
to indicate incorrect GPIO direction settings. In some cases it also
prevents setting GPIO output values.

The problem is also present in all other stable kernel versions since
linux-3.12.

Reported-by: Jochen Henneberg <redacted>
Signed-off-by: Michael Brunner <redacted>
Patch applied and tagged for stable v3.12+

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help