Skip to contentSkip to conversation

regulator: st-pwm: Convert to get_voltage_sel

PATCH Applied Axel Lin 3 participants 3 messages Mar 21, 2014 – Mar 24, 2014 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: st-pwm: Convert to get_voltage_sel

Also remove test for selector in st_pwm_regulator_set_voltage_sel, the checking is already done in .list_voltage.

---
 drivers/regulator/st-pwm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/regulator/st-pwm.c +3 -6
index 6ef569f..e367af1 100644
@@ -39,11 +39,11 @@ struct st_pwm_voltages {
 	unsigned int dutycycle;
 };
 
-static int st_pwm_regulator_get_voltage(struct regulator_dev *dev)
+static int st_pwm_regulator_get_voltage_sel(struct regulator_dev *dev)
 {
 	struct st_pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
 
-	return drvdata->pdata->duty_cycle_table[drvdata->state].uV;
+	return drvdata->state;
 }
 
 static int st_pwm_regulator_set_voltage_sel(struct regulator_dev *dev,
@@ -53,9 +53,6 @@ static int st_pwm_regulator_set_voltage_sel(struct regulator_dev *dev,
 	int dutycycle;
 	int ret;
 
-	if (selector >= dev->desc->n_voltages)
-		return -EINVAL;
-
 	dutycycle = (ST_PWM_REG_PERIOD / 100) *
 		drvdata->pdata->duty_cycle_table[selector].dutycycle;
 
@@ -92,7 +89,7 @@ static int st_pwm_regulator_list_voltage(struct regulator_dev *dev,
 
 static struct regulator_ops st_pwm_regulator_voltage_ops = {
 	.set_voltage_sel = st_pwm_regulator_set_voltage_sel,
-	.get_voltage     = st_pwm_regulator_get_voltage,
+	.get_voltage_sel = st_pwm_regulator_get_voltage_sel,
 	.list_voltage    = st_pwm_regulator_list_voltage,
 	.map_voltage     = regulator_map_voltage_iterate,
 };
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

Also remove test for selector in st_pwm_regulator_set_voltage_sel, the checking is already done in .list_voltage.

---
 drivers/regulator/st-pwm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Wow! Not even going to give me a chance to fix it myself eh?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer Applied
#2 lore raw
In reply to Axel Lin
Quoted 2 lines · Axel Lin

Also remove test for selector in st_pwm_regulator_set_voltage_sel, the checking is already done in .list_voltage.

Applied, thanks.