lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1371713084-19098-3-git-send-email-patrice.chotard.st@gmail.com>
Date:	Thu, 20 Jun 2013 09:24:44 +0200
From:	<patrice.chotard.st@...il.com>
To:	<linux-kernel@...r.kernel.org>,
	Linus Walleij <linus.walleij@...aro.org>
Cc:	Olivier Clergeaud <olivier.clergeaud@...com>,
	Lee Jones <lee.jones@...aro.org>,
	Fabio Baltieri <fabio.baltieri@...aro.org>,
	Patrice Chotard <patrice.chotard@...com>
Subject: [PATCH 2/2] pinctrl: abx500: fix abx500_gpio_get()

From: Patrice Chotard <patrice.chotard@...com>

_ allow to get output GPIO value.
_ as there is no GPIO0 on ABX500, use correct offset with 
  abx500_gpio_get_bit().

Signed-off-by: Patrice Chotard <patrice.chotard@...com>
---
 drivers/pinctrl/pinctrl-abx500.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 4307b0f..070442d 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -162,10 +162,22 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
 	bool bit;
+	bool is_out;
+	u8 gpio_offset = offset - 1;
 	int ret;
 
-	ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
-				  offset, &bit);
+	ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, &is_out);
+	if (ret < 0) {
+		dev_err(pct->dev, "%s failed\n", __func__);
+		return ret;
+	}
+
+	if (is_out)
+		ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG,
+				gpio_offset, &bit);
+	else
+		ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
+				gpio_offset, &bit);
 	if (ret < 0) {
 		dev_err(pct->dev, "%s failed\n", __func__);
 		return ret;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ