From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Liam Girdwood <lrg@ti.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage
Date: Tue, 11 Dec 2012 20:36:37 +0800 [thread overview]
Message-ID: <1355229397.6766.2.camel@phoenix> (raw)
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
next reply other threads:[~2012-12-11 12:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 12:36 Axel Lin [this message]
2012-12-11 12:44 ` [PATCH] regulator: core: Fix logic to determinate if regulator can change voltage Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355229397.6766.2.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=m.szyprowski@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).