aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9a6757decd3d..02a774424e8d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -241,6 +241,22 @@ static ssize_t regulator_uA_show(struct device *dev,
241 return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev)); 241 return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
242} 242}
243 243
244static ssize_t regulator_name_show(struct device *dev,
245 struct device_attribute *attr, char *buf)
246{
247 struct regulator_dev *rdev = dev_get_drvdata(dev);
248 const char *name;
249
250 if (rdev->constraints->name)
251 name = rdev->constraints->name;
252 else if (rdev->desc->name)
253 name = rdev->desc->name;
254 else
255 name = "";
256
257 return sprintf(buf, "%s\n", name);
258}
259
244static ssize_t regulator_opmode_show(struct device *dev, 260static ssize_t regulator_opmode_show(struct device *dev,
245 struct device_attribute *attr, char *buf) 261 struct device_attribute *attr, char *buf)
246{ 262{
@@ -473,7 +489,9 @@ static ssize_t regulator_suspend_standby_state_show(struct device *dev,
473 else 489 else
474 return sprintf(buf, "disabled\n"); 490 return sprintf(buf, "disabled\n");
475} 491}
492
476static struct device_attribute regulator_dev_attrs[] = { 493static struct device_attribute regulator_dev_attrs[] = {
494 __ATTR(name, 0444, regulator_name_show, NULL),
477 __ATTR(microvolts, 0444, regulator_uV_show, NULL), 495 __ATTR(microvolts, 0444, regulator_uV_show, NULL),
478 __ATTR(microamps, 0444, regulator_uA_show, NULL), 496 __ATTR(microamps, 0444, regulator_uA_show, NULL),
479 __ATTR(opmode, 0444, regulator_opmode_show, NULL), 497 __ATTR(opmode, 0444, regulator_opmode_show, NULL),