Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbbEKKrF (ORCPT ); Mon, 11 May 2015 06:47:05 -0400 Received: from mout.gmx.net ([212.227.15.18]:61908 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbbEKKrB (ORCPT ); Mon, 11 May 2015 06:47:01 -0400 Date: Mon, 11 May 2015 12:46:49 +0200 From: Michael Brunner To: linux-kernel@vger.kernel.org Cc: Linus Walleij , Alexandre Courbot , linux-gpio@vger.kernel.org, Jochen Henneberg , Michael Brunner , Darren Hart , Kevin Strasser , Guenter Roeck Subject: [PATCH] gpio: gpio-kempld: Fix get_direction return value Message-ID: <20150511124649.1221e86e@hyperion> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:eAw9bhdZeYMBJ6lbljnfyPBap3/7j0LpP8NTAZemwLlnkWB2z0X mElpW1+A9n8dws1cs2NoHL/MmYq1I1WhzijyZV7/QJ2WO2WJo2IthnW2WklwwUy3oGwvWr+ heosfcemU/J8EofldIvL6/zSOhucUIHwdYQlCULBgE4jZdKOUSWdkPu+OF0iW/oaFWXTIUt GXxnxRerVjyv8vqR0MICQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1389 Lines: 36 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 Signed-off-by: Michael Brunner --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/