Skip to contentSkip to conversation

gpio: gpio-kempld: Fix get_direction return value

PATCH In review Michael Brunner 3 participants 3 messages May 11, 2015 – May 12, 2015 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: gpio-kempld: Fix get_direction return value

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.

---
 drivers/gpio/gpio-kempld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-kempld.c +1 -1
index 6b8115f..83f281d 100644
@@ -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)
Signature · 1 line
1.8.5.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Michael Brunner

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.

Quoted 5 lines

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

#2 lore raw
In reply to Michael Brunner
Quoted 7 lines · Michael Brunner

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.

Quoted 5 lines

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

Patch applied and tagged for stable v3.12+

Yours,
Linus Walleij