Commit a07ac217 authored by Mark Brown's avatar Mark Brown Committed by Liam Girdwood

regulator: Make virtual consumer use dev_printk

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent d61c3d56
...@@ -27,17 +27,18 @@ struct virtual_consumer_data { ...@@ -27,17 +27,18 @@ struct virtual_consumer_data {
unsigned int mode; unsigned int mode;
}; };
static void update_voltage_constraints(struct virtual_consumer_data *data) static void update_voltage_constraints(struct device *dev,
struct virtual_consumer_data *data)
{ {
int ret; int ret;
if (data->min_uV && data->max_uV if (data->min_uV && data->max_uV
&& data->min_uV <= data->max_uV) { && data->min_uV <= data->max_uV) {
ret = regulator_set_voltage(data->regulator, ret = regulator_set_voltage(data->regulator,
data->min_uV, data->max_uV); data->min_uV, data->max_uV);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR "regulator_set_voltage() failed: %d\n", dev_err(dev,
ret); "regulator_set_voltage() failed: %d\n", ret);
return; return;
} }
} }
...@@ -47,7 +48,7 @@ static void update_voltage_constraints(struct virtual_consumer_data *data) ...@@ -47,7 +48,7 @@ static void update_voltage_constraints(struct virtual_consumer_data *data)
if (ret == 0) if (ret == 0)
data->enabled = 1; data->enabled = 1;
else else
printk(KERN_ERR "regulator_enable() failed: %d\n", dev_err(dev, "regulator_enable() failed: %d\n",
ret); ret);
} }
...@@ -56,13 +57,13 @@ static void update_voltage_constraints(struct virtual_consumer_data *data) ...@@ -56,13 +57,13 @@ static void update_voltage_constraints(struct virtual_consumer_data *data)
if (ret == 0) if (ret == 0)
data->enabled = 0; data->enabled = 0;
else else
printk(KERN_ERR "regulator_disable() failed: %d\n", dev_err(dev, "regulator_disable() failed: %d\n",
ret); ret);
} }
} }
static void update_current_limit_constraints(struct virtual_consumer_data static void update_current_limit_constraints(struct device *dev,
*data) struct virtual_consumer_data *data)
{ {
int ret; int ret;
...@@ -71,8 +72,9 @@ static void update_current_limit_constraints(struct virtual_consumer_data ...@@ -71,8 +72,9 @@ static void update_current_limit_constraints(struct virtual_consumer_data
ret = regulator_set_current_limit(data->regulator, ret = regulator_set_current_limit(data->regulator,
data->min_uA, data->max_uA); data->min_uA, data->max_uA);
if (ret != 0) { if (ret != 0) {
pr_err("regulator_set_current_limit() failed: %d\n", dev_err(dev,
ret); "regulator_set_current_limit() failed: %d\n",
ret);
return; return;
} }
} }
...@@ -82,7 +84,7 @@ static void update_current_limit_constraints(struct virtual_consumer_data ...@@ -82,7 +84,7 @@ static void update_current_limit_constraints(struct virtual_consumer_data
if (ret == 0) if (ret == 0)
data->enabled = 1; data->enabled = 1;
else else
printk(KERN_ERR "regulator_enable() failed: %d\n", dev_err(dev, "regulator_enable() failed: %d\n",
ret); ret);
} }
...@@ -91,7 +93,7 @@ static void update_current_limit_constraints(struct virtual_consumer_data ...@@ -91,7 +93,7 @@ static void update_current_limit_constraints(struct virtual_consumer_data
if (ret == 0) if (ret == 0)
data->enabled = 0; data->enabled = 0;
else else
printk(KERN_ERR "regulator_disable() failed: %d\n", dev_err(dev, "regulator_disable() failed: %d\n",
ret); ret);
} }
} }
...@@ -115,7 +117,7 @@ static ssize_t set_min_uV(struct device *dev, struct device_attribute *attr, ...@@ -115,7 +117,7 @@ static ssize_t set_min_uV(struct device *dev, struct device_attribute *attr,
mutex_lock(&data->lock); mutex_lock(&data->lock);
data->min_uV = val; data->min_uV = val;
update_voltage_constraints(data); update_voltage_constraints(dev, data);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
...@@ -141,7 +143,7 @@ static ssize_t set_max_uV(struct device *dev, struct device_attribute *attr, ...@@ -141,7 +143,7 @@ static ssize_t set_max_uV(struct device *dev, struct device_attribute *attr,
mutex_lock(&data->lock); mutex_lock(&data->lock);
data->max_uV = val; data->max_uV = val;
update_voltage_constraints(data); update_voltage_constraints(dev, data);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
...@@ -167,7 +169,7 @@ static ssize_t set_min_uA(struct device *dev, struct device_attribute *attr, ...@@ -167,7 +169,7 @@ static ssize_t set_min_uA(struct device *dev, struct device_attribute *attr,
mutex_lock(&data->lock); mutex_lock(&data->lock);
data->min_uA = val; data->min_uA = val;
update_current_limit_constraints(data); update_current_limit_constraints(dev, data);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
...@@ -193,7 +195,7 @@ static ssize_t set_max_uA(struct device *dev, struct device_attribute *attr, ...@@ -193,7 +195,7 @@ static ssize_t set_max_uA(struct device *dev, struct device_attribute *attr,
mutex_lock(&data->lock); mutex_lock(&data->lock);
data->max_uA = val; data->max_uA = val;
update_current_limit_constraints(data); update_current_limit_constraints(dev, data);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment