Skip to contentSkip to conversation

regulator: core: Fix logic to determinate if regulator can change voltage

PATCH Applied Axel Lin 2 participants 2 messages Dec 11, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: core: Fix logic to determinate if regulator can change voltage

Having a linear_min_sel setting means the first linear_min_sel selectors are invalid. We need to subtract linear_min_sel when use n_voltages to determinate if regulator can change voltage.

---
 drivers/regulator/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
index cd1b201..0f65b24 100644
@@ -1886,7 +1886,7 @@ int regulator_can_change_voltage(struct regulator *regulator)
 
 	if (rdev->constraints &&
 	    rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
-	    rdev->desc->n_voltages > 1)
+	    (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
 		return 1;
 
 	return 0;
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 3 lines · Axel Lin

Having a linear_min_sel setting means the first linear_min_sel selectors are invalid. We need to subtract linear_min_sel when use n_voltages to determinate if regulator can change voltage.

Applied, thanks.