|
@@ -303,18 +303,6 @@ static int regulator_check_drms(struct regulator_dev *rdev)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static ssize_t device_requested_uA_show(struct device *dev,
|
|
|
- struct device_attribute *attr, char *buf)
|
|
|
-{
|
|
|
- struct regulator *regulator;
|
|
|
-
|
|
|
- regulator = get_device_regulator(dev);
|
|
|
- if (regulator == NULL)
|
|
|
- return 0;
|
|
|
-
|
|
|
- return sprintf(buf, "%d\n", regulator->uA_load);
|
|
|
-}
|
|
|
-
|
|
|
static ssize_t regulator_uV_show(struct device *dev,
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
{
|
|
@@ -1097,48 +1085,27 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
|
|
|
list_add(®ulator->list, &rdev->consumer_list);
|
|
|
|
|
|
if (dev) {
|
|
|
- /* create a 'requested_microamps_name' sysfs entry */
|
|
|
- size = scnprintf(buf, REG_STR_SIZE,
|
|
|
- "microamps_requested_%s-%s",
|
|
|
- dev_name(dev), supply_name);
|
|
|
- if (size >= REG_STR_SIZE)
|
|
|
- goto overflow_err;
|
|
|
-
|
|
|
- regulator->dev = dev;
|
|
|
- sysfs_attr_init(®ulator->dev_attr.attr);
|
|
|
- regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
|
|
|
- if (regulator->dev_attr.attr.name == NULL)
|
|
|
- goto attr_name_err;
|
|
|
-
|
|
|
- regulator->dev_attr.attr.mode = 0444;
|
|
|
- regulator->dev_attr.show = device_requested_uA_show;
|
|
|
- err = device_create_file(dev, ®ulator->dev_attr);
|
|
|
- if (err < 0) {
|
|
|
- rdev_warn(rdev, "could not add regulator_dev requested microamps sysfs entry\n");
|
|
|
- goto attr_name_err;
|
|
|
- }
|
|
|
-
|
|
|
- /* also add a link to the device sysfs entry */
|
|
|
+ /* Add a link to the device sysfs entry */
|
|
|
size = scnprintf(buf, REG_STR_SIZE, "%s-%s",
|
|
|
dev->kobj.name, supply_name);
|
|
|
if (size >= REG_STR_SIZE)
|
|
|
- goto attr_err;
|
|
|
+ goto overflow_err;
|
|
|
|
|
|
regulator->supply_name = kstrdup(buf, GFP_KERNEL);
|
|
|
if (regulator->supply_name == NULL)
|
|
|
- goto attr_err;
|
|
|
+ goto overflow_err;
|
|
|
|
|
|
err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
|
|
|
buf);
|
|
|
if (err) {
|
|
|
rdev_warn(rdev, "could not add device link %s err %d\n",
|
|
|
dev->kobj.name, err);
|
|
|
- goto link_name_err;
|
|
|
+ /* non-fatal */
|
|
|
}
|
|
|
} else {
|
|
|
regulator->supply_name = kstrdup(supply_name, GFP_KERNEL);
|
|
|
if (regulator->supply_name == NULL)
|
|
|
- goto attr_err;
|
|
|
+ goto overflow_err;
|
|
|
}
|
|
|
|
|
|
regulator->debugfs = debugfs_create_dir(regulator->supply_name,
|
|
@@ -1165,12 +1132,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
|
|
|
|
|
|
mutex_unlock(&rdev->mutex);
|
|
|
return regulator;
|
|
|
-link_name_err:
|
|
|
- kfree(regulator->supply_name);
|
|
|
-attr_err:
|
|
|
- device_remove_file(regulator->dev, ®ulator->dev_attr);
|
|
|
-attr_name_err:
|
|
|
- kfree(regulator->dev_attr.attr.name);
|
|
|
overflow_err:
|
|
|
list_del(®ulator->list);
|
|
|
kfree(regulator);
|