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]
Date:	Wed,  9 Dec 2009 15:49:04 +0200
From:	Jani Nikula <ext-jani.1.nikula@...ia.com>
To:	dbrownell@...rs.sourceforge.net, gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org, dsilvers@...tec.co.uk,
	ben@...tec.co.uk, Artem.Bityutskiy@...ia.com,
	akpm@...ux-foundation.org, ext-jani.1.nikula@...ia.com
Subject: [PATCH 3/3] gpiolib: use chip->names for symlinks, always use gpioN for device names

Restore gpiolib sysfs device naming back to /sys/class/gpio/gpioN, where
N is the GPIO number. Use the chip->names mechanism for creating
symlinks to those devices instead of creating the devices using
chip->names. All GPIO naming (other than gpioN) in gpiolib sysfs is now
done using symlinks.

While the device names are now unique again, collisions in chip->names
will still prevent duplicates from being exported to sysfs.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@...ia.com>
---
 drivers/gpio/gpiolib.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f254195..fe7ffad 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -740,7 +740,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 		struct device	*dev;
 
 		dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
-				desc, ioname ? ioname : "gpio%d", gpio);
+				desc, "gpio%d", gpio);
 		if (!IS_ERR(dev)) {
 			if (direction_may_change)
 				status = sysfs_create_group(&dev->kobj,
@@ -756,6 +756,10 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 				status = device_create_file(dev,
 						&dev_attr_edge);
 
+			if (!status && ioname != NULL)
+				status = create_link(gpio, NULL, &dev->kobj,
+						ioname);
+
 			if (status != 0)
 				device_unregister(dev);
 		} else
-- 
1.6.5.2

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