Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261335 > unrolled thread
| Started by | Mark Brown <broonie@kernel.org> |
|---|---|
| First post | 2015-11-03 10:30 +0100 |
| Last post | 2015-11-04 01:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] regulator: Use regulator_lock_supply() for get_voltage() too Mark Brown <broonie@kernel.org> - 2015-11-03 10:30 +0100
Applied "regulator: Use regulator_lock_supply() for get_voltage() too" to the regulator tree Mark Brown <broonie@kernel.org> - 2015-11-03 16:20 +0100
Re: [PATCH] regulator: Use regulator_lock_supply() for get_voltage() too John Stultz <john.stultz@linaro.org> - 2015-11-04 01:00 +0100
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-11-03 10:30 +0100 |
| Subject | [PATCH] regulator: Use regulator_lock_supply() for get_voltage() too |
| Message-ID | <qqG4G-OO-33@gated-at.bofh.it> |
Since we need to read voltages of parents as part of setting supply
voltages we need to be able to do get_voltage() internally without
taking locks so reorganize the locking to take locks on the full tree on
entry rather than as we recurse when called externally.
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index ff9cc3a6895f..73b7683355cd 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3110,7 +3110,7 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
} else if (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1)) {
ret = rdev->desc->fixed_uV;
} else if (rdev->supply) {
- ret = regulator_get_voltage(rdev->supply);
+ ret = _regulator_get_voltage(rdev->supply->rdev);
} else {
return -EINVAL;
}
@@ -3133,11 +3133,11 @@ int regulator_get_voltage(struct regulator *regulator)
{
int ret;
- mutex_lock(®ulator->rdev->mutex);
+ regulator_lock_supply(regulator->rdev);
ret = _regulator_get_voltage(regulator->rdev);
- mutex_unlock(®ulator->rdev->mutex);
+ regulator_unlock_supply(regulator->rdev);
return ret;
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-11-03 16:20 +0100 |
| Subject | Applied "regulator: Use regulator_lock_supply() for get_voltage() too" to the regulator tree |
| Message-ID | <qqLxo-4or-7@gated-at.bofh.it> |
| In reply to | #1261335 |
The patch
regulator: Use regulator_lock_supply() for get_voltage() too
has been applied to the regulator tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From e8debdfce55c8fcf2c9448b6adfd06ec75b7a844 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Tue, 3 Nov 2015 05:58:14 +0000
Subject: [PATCH] regulator: Use regulator_lock_supply() for get_voltage() too
Since we need to read voltages of parents as part of setting supply
voltages we need to be able to do get_voltage() internally without
taking locks so reorganize the locking to take locks on the full tree on
entry rather than as we recurse when called externally.
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 771c6235cced..b4970eb85357 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3055,7 +3055,7 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
} else if (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1)) {
ret = rdev->desc->fixed_uV;
} else if (rdev->supply) {
- ret = regulator_get_voltage(rdev->supply);
+ ret = _regulator_get_voltage(rdev->supply->rdev);
} else {
return -EINVAL;
}
@@ -3078,11 +3078,11 @@ int regulator_get_voltage(struct regulator *regulator)
{
int ret;
- mutex_lock(®ulator->rdev->mutex);
+ regulator_lock_supply(regulator->rdev);
ret = _regulator_get_voltage(regulator->rdev);
- mutex_unlock(®ulator->rdev->mutex);
+ regulator_unlock_supply(regulator->rdev);
return ret;
}
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2015-11-04 01:00 +0100 |
| Message-ID | <qqTEC-171-1@gated-at.bofh.it> |
| In reply to | #1261335 |
On Tue, Nov 3, 2015 at 1:23 AM, Mark Brown <broonie@kernel.org> wrote: > Since we need to read voltages of parents as part of setting supply > voltages we need to be able to do get_voltage() internally without > taking locks so reorganize the locking to take locks on the full tree on > entry rather than as we recurse when called externally. > > Reported-by: John Stultz <john.stultz@linaro.org> > Signed-off-by: Mark Brown <broonie@kernel.org> This resolves the issue for me, thanks! Tested-by: John Stultz <john.stultz@linaro.org> -john -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web