Skip to contentSkip to conversation

regulator: s5m8767: Constify s5m8767_opmode_reg

PATCH In review Axel Lin 2 participants 4 messages Feb 21, 2019

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: s5m8767: Constify s5m8767_opmode_reg

The s5m8767_opmode_reg should never change, make it const.

---
 drivers/regulator/s5m8767.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/s5m8767.c +1 -1
index b581f01f3395..5b0e1fe6723f 100644
@@ -115,7 +115,7 @@ static const struct sec_voltage_desc *reg_voltage_map[] = {
 	[S5M8767_BUCK9] = &buck_voltage_val3,
 };
 
-static unsigned int s5m8767_opmode_reg[][4] = {
+static const unsigned int s5m8767_opmode_reg[][4] = {
 	/* {OFF, ON, LOWPOWER, SUSPEND} */
 	/* LDO1 ... LDO28 */
 	{0x0, 0x3, 0x2, 0x1}, /* LDO1 */
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 regulator: s5m8767: Simplify s5m8767_set_voltage_time_sel implementation

---
 drivers/regulator/s5m8767.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/regulator/s5m8767.c +1 -5
index 5b0e1fe6723f..bb9d1a083299 100644
@@ -339,13 +339,9 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,
 					     unsigned int new_sel)
 {
 	struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
-	const struct sec_voltage_desc *desc;
-	int reg_id = rdev_get_id(rdev);
-
-	desc = reg_voltage_map[reg_id];
 
 	if ((old_sel < new_sel) && s5m8767->ramp_delay)
-		return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
+		return DIV_ROUND_UP(rdev->desc->uV_step * (new_sel - old_sel),
 					s5m8767->ramp_delay * 1000);
 	return 0;
 }
Signature · 1 line
2.17.1