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-next>] [day] [month] [year] [list]
Message-ID: <1361433237-3217-1-git-send-email-sjoo@nvidia.com>
Date:	Thu, 21 Feb 2013 16:53:57 +0900
From:	Shawn Joo <sjoo@...dia.com>
To:	<broonie@...nsource.wolfsonmicro.com>,
	<linux-kernel@...r.kernel.org>
CC:	<sjoo@...dia.com>
Subject: [PATCH] regulator: core: use regulator name for sysfs

regulator is named by numbering on sysfs, e.g. regulator.0, regulator.1
it confuses to find desired regulator before counting the order.
add option for regulator name by use_name_onsysfs.
if it is true and name is not NULL, desc's name will be the name.
e.g. if name in desc is "LDO0", then regulator.LDO0 on sysfs.
otherwise it follows origin.

Signed-off-by: Shawn Joo <sjoo@...dia.com>
---
 drivers/regulator/core.c         |    7 ++++++-
 include/linux/regulator/driver.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 2785843..4dde54d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3399,7 +3399,12 @@ regulator_register(const struct regulator_desc *regulator_desc,
 	rdev->dev.class = &regulator_class;
 	rdev->dev.of_node = config->of_node;
 	rdev->dev.parent = dev;
-	dev_set_name(&rdev->dev, "regulator.%d",
+	if (regulator_desc->use_name_onsysfs &&
+			regulator_desc->name != NULL)
+		dev_set_name(&rdev->dev, "regulator.%s",
+			regulator_desc->name);
+	else
+		dev_set_name(&rdev->dev, "regulator.%d",
 		     atomic_inc_return(&regulator_no) - 1);
 	ret = device_register(&rdev->dev);
 	if (ret != 0) {
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d10bb0f..597f8dd 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -224,6 +224,7 @@ struct regulator_desc {
 	unsigned int bypass_mask;
 
 	unsigned int enable_time;
+	bool use_name_onsysfs;
 };
 
 /**
-- 
1.7.0.4

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