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>] [day] [month] [year] [list]
Date:	Thu, 16 Oct 2008 12:45:59 -0700
From:	David Brownell <david-b@...bell.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	lkml <linux-kernel@...r.kernel.org>
Subject: Fwd: [PATCH] Modify sysfs gpio export so that "value" displays as 0 or 1


----------  Forwarded Message  ----------

Subject: [PATCH] Modify sysfs gpio export so that "value" displays as 0 or 1
Date: Friday 10 October 2008
From: "Steven A. Falco" <sfalco@...ris.com>
To: "linuxppc-dev@...abs.org" <linuxppc-dev@...abs.org>, david-b@...bell.net

gpiolib can export GPIOs to userspace via sysfs.  This patch modifies
the gpio_value_show() so that any non-zero value is explicitly printed
as "1", rather than whatever numerical value the lower-level driver returns.

Signed-off-by: Steve Falco <sfalco@...ris.com>
Signed-off-by: David Brownell <dbrownell@...rs.sourceforge.net>
---

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8d29405..36bf72b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -237,7 +237,7 @@ static ssize_t gpio_value_show(struct device *dev,
 	if (!test_bit(FLAG_EXPORT, &desc->flags))
 		status = -EIO;
 	else
-		status = sprintf(buf, "%d\n", gpio_get_value_cansleep(gpio));
+		status = sprintf(buf, "%d\n", !!gpio_get_value_cansleep(gpio));
 
 	mutex_unlock(&sysfs_lock);
 	return status;


-------------------------------------------------------
--
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