Skip to contentSkip to conversation

regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel

PATCH Applied Axel Lin 2 participants 2 messages Jan 9, 2013 – Jan 10, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH v2 1/1 regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel

Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time.

---
v2: Only fix integer division truncation issue, remove other optimization.

 drivers/regulator/max8998.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max8998.c +1 -1
index 06be8cc..1f0df40 100644
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 
 	difference = (new_selector - old_selector) * desc->step / 1000;
 	if (difference > 0)
-		return difference / ((val & 0x0f) + 1);
+		return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 2 lines · Axel Lin

Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time.

Applied, thanks.