From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 1/6] regulator: Also lift apply_uV into machine_constraints_voltage()
Date: Thu, 22 Oct 2009 16:31:30 +0100 [thread overview]
Message-ID: <1256225495-15379-1-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
It makes sense to do all the voltage configuration in the one split
out function.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/regulator/core.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c1a4991..1848a3f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -676,6 +676,22 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
const char *name, struct regulation_constraints *constraints)
{
struct regulator_ops *ops = rdev->desc->ops;
+ int ret;
+
+ /* do we need to apply the constraint voltage */
+ if (rdev->constraints->apply_uV &&
+ rdev->constraints->min_uV == rdev->constraints->max_uV &&
+ ops->set_voltage) {
+ ret = ops->set_voltage(rdev,
+ rdev->constraints->min_uV, rdev->constraints->max_uV);
+ if (ret < 0) {
+ printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
+ __func__,
+ rdev->constraints->min_uV, name);
+ rdev->constraints = NULL;
+ return ret;
+ }
+ }
/* constrain machine-level voltage specs to fit
* the actual range supported by this regulator.
@@ -773,27 +789,12 @@ static int set_machine_constraints(struct regulator_dev *rdev,
else
name = "regulator";
+ rdev->constraints = constraints;
+
ret = machine_constraints_voltage(rdev, name, constraints);
if (ret != 0)
goto out;
- rdev->constraints = constraints;
-
- /* do we need to apply the constraint voltage */
- if (rdev->constraints->apply_uV &&
- rdev->constraints->min_uV == rdev->constraints->max_uV &&
- ops->set_voltage) {
- ret = ops->set_voltage(rdev,
- rdev->constraints->min_uV, rdev->constraints->max_uV);
- if (ret < 0) {
- printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
- __func__,
- rdev->constraints->min_uV, name);
- rdev->constraints = NULL;
- goto out;
- }
- }
-
/* do we need to setup our suspend state */
if (constraints->initial_state) {
ret = suspend_prepare(rdev, constraints->initial_state);
--
1.6.5
next reply other threads:[~2009-10-22 15:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 15:31 Mark Brown [this message]
2009-10-22 15:31 ` [PATCH 2/6] regulator: Display actual settings with constraints Mark Brown
2009-10-22 15:31 ` [PATCH 3/6] regulator: Factor out regulator name pretty printing Mark Brown
2009-10-22 15:31 ` [PATCH 4/6] regulator: Handle regulators without suspend mode configuration Mark Brown
2009-10-22 15:31 ` [PATCH 5/6] regulator: Remove duplicate consts from ab3100 Mark Brown
2009-10-22 15:31 ` [PATCH 6/6] regulator: Ensure val is initialised in 88pm8607 choose_voltage() Mark Brown
2009-10-26 13:40 ` [PATCH 1/6] regulator: Also lift apply_uV into machine_constraints_voltage() Liam Girdwood
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=1256225495-15379-1-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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
Powered by JetHome