Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262149
b: refs/heads/master
c: 5de7051
h: refs/heads/master
i:
  262147: 4dbeb0d
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Jul 4, 2011
1 parent 6516433 commit b88893e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d51a0dbe51282f3ed13cadf6e7f13a974374be2
refs/heads/master: 5de705194e9883a39f993e2ff96028d5aab99b37
30 changes: 29 additions & 1 deletion trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ struct regulator {
char *supply_name;
struct device_attribute dev_attr;
struct regulator_dev *rdev;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs;
#endif
};

static int _regulator_is_enabled(struct regulator_dev *rdev);
Expand Down Expand Up @@ -1093,7 +1096,28 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
dev->kobj.name, err);
goto link_name_err;
}
} else {
regulator->supply_name = kstrdup(supply_name, GFP_KERNEL);
if (regulator->supply_name == NULL)
goto attr_err;
}

#ifdef CONFIG_DEBUG_FS
regulator->debugfs = debugfs_create_dir(regulator->supply_name,
rdev->debugfs);
if (IS_ERR_OR_NULL(regulator->debugfs)) {
rdev_warn(rdev, "Failed to create debugfs directory\n");
regulator->debugfs = NULL;
} else {
debugfs_create_u32("uA_load", 0444, regulator->debugfs,
&regulator->uA_load);
debugfs_create_u32("min_uV", 0444, regulator->debugfs,
&regulator->min_uV);
debugfs_create_u32("max_uV", 0444, regulator->debugfs,
&regulator->max_uV);
}
#endif

mutex_unlock(&rdev->mutex);
return regulator;
link_name_err:
Expand Down Expand Up @@ -1272,13 +1296,17 @@ void regulator_put(struct regulator *regulator)
mutex_lock(&regulator_list_mutex);
rdev = regulator->rdev;

#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(regulator->debugfs);
#endif

/* remove any sysfs entries */
if (regulator->dev) {
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
kfree(regulator->supply_name);
device_remove_file(regulator->dev, &regulator->dev_attr);
kfree(regulator->dev_attr.attr.name);
}
kfree(regulator->supply_name);
list_del(&regulator->list);
kfree(regulator);

Expand Down

0 comments on commit b88893e

Please sign in to comment.