linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage
@ 2012-12-11 12:36 Axel Lin
  2012-12-11 12:44 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-12-11 12:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Marek Szyprowski, Liam Girdwood, linux-kernel

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.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cd1b201..0f65b24 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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;
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage
  2012-12-11 12:36 [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage Axel Lin
@ 2012-12-11 12:44 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-12-11 12:44 UTC (permalink / raw)
  To: Axel Lin; +Cc: Marek Szyprowski, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On Tue, Dec 11, 2012 at 08:36:37PM +0800, Axel Lin wrote:
> 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-11 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 12:36 [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage Axel Lin
2012-12-11 12:44 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).