lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1395444158.25974.1.camel@phoenix>
Date:	Sat, 22 Mar 2014 07:22:38 +0800
From:	Axel Lin <axel.lin@...ics.com>
To:	Mark Brown <broonie@...nel.org>
Cc:	Lee Jones <lee.jones@...aro.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] 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.

Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
 drivers/regulator/st-pwm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/st-pwm.c b/drivers/regulator/st-pwm.c
index 6ef569f..e367af1 100644
--- a/drivers/regulator/st-pwm.c
+++ b/drivers/regulator/st-pwm.c
@@ -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,
 };
-- 
1.8.3.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ