Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610170 > unrolled thread
| Started by | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| First post | 2017-03-28 02:00 +0200 |
| Last post | 2017-03-29 14:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v4] regulator: core: Limit propagation of parent voltage count and list Matthias Kaehlcke <mka@chromium.org> - 2017-03-28 02:00 +0200
Re: [PATCH v4] regulator: core: Limit propagation of parent voltage count and list Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-28 02:10 +0200
Applied "regulator: core: Limit propagation of parent voltage count and list" to the regulator tree Mark Brown <broonie@kernel.org> - 2017-03-29 14:00 +0200
| From | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| Date | 2017-03-28 02:00 +0200 |
| Subject | [PATCH v4] regulator: core: Limit propagation of parent voltage count and list |
| Message-ID | <tpMIi-7o5-7@gated-at.bofh.it> |
Commit 26988efe11b1 ("regulator: core: Allow to get voltage count and
list from parent") introduces the propagation of the parent voltage
count and list for regulators that don't provide this information
themselves. The goal is to support simple switch regulators, however as
a side effect normal continuous regulators can leak details of their
supplies and provide consumers with inconsistent information.
Limit the propagation of the voltage count and list to switch
regulators.
Fixes: 26988efe11b1 ("regulator: core: Allow to get voltage count and
list from parent")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
Changes in v4:
- Removed redundant check of .get_voltage_sel (implicitly done by .list_voltage check)
- Added 'Fixes' tag to commit message
Changes in v3:
- Removed unused variable ops from regulator_count_voltages()
- Updated commit message to use correct format for referencing commits
Changes in v2:
- Added flag 'is_switch' that indicates if regulator is a switch
- Reworked conditions checking for switch to evaluate the new flag
drivers/regulator/core.c | 9 +++++++--
include/linux/regulator/driver.h | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 53d4fc70dbd0..a99a975fb89f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2486,7 +2486,7 @@ static int _regulator_list_voltage(struct regulator *regulator,
ret = ops->list_voltage(rdev, selector);
if (lock)
mutex_unlock(&rdev->mutex);
- } else if (rdev->supply) {
+ } else if (rdev->is_switch && rdev->supply) {
ret = _regulator_list_voltage(rdev->supply, selector, lock);
} else {
return -EINVAL;
@@ -2544,7 +2544,7 @@ int regulator_count_voltages(struct regulator *regulator)
if (rdev->desc->n_voltages)
return rdev->desc->n_voltages;
- if (!rdev->supply)
+ if (!rdev->is_switch || !rdev->supply)
return -EINVAL;
return regulator_count_voltages(rdev->supply);
@@ -4099,6 +4099,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
mutex_unlock(®ulator_list_mutex);
}
+ if (!rdev->desc->ops->get_voltage &&
+ !rdev->desc->ops->list_voltage &&
+ !rdev->desc->fixed_uV)
+ rdev->is_switch = true;
+
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index dac8e7b16bc6..4cb1c9be6073 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -429,6 +429,8 @@ struct regulator_dev {
struct regulator_enable_gpio *ena_pin;
unsigned int ena_gpio_state:1;
+ unsigned int is_switch:1;
+
/* time when this regulator was disabled last time */
unsigned long last_off_jiffy;
};
--
2.12.2.564.g063fe858b8-goog
[toc] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-28 02:10 +0200 |
| Subject | Re: [PATCH v4] regulator: core: Limit propagation of parent voltage count and list |
| Message-ID | <tpMRX-7JX-5@gated-at.bofh.it> |
| In reply to | #1610170 |
Hello Matthias,
On 03/27/2017 07:54 PM, Matthias Kaehlcke wrote:
> Commit 26988efe11b1 ("regulator: core: Allow to get voltage count and
> list from parent") introduces the propagation of the parent voltage
> count and list for regulators that don't provide this information
> themselves. The goal is to support simple switch regulators, however as
> a side effect normal continuous regulators can leak details of their
> supplies and provide consumers with inconsistent information.
>
> Limit the propagation of the voltage count and list to switch
> regulators.
>
> Fixes: 26988efe11b1 ("regulator: core: Allow to get voltage count and
> list from parent")
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
You should had carried collected tags since this version is almost
identical to the previous one, but for reference here are again:
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2017-03-29 14:00 +0200 |
| Subject | Applied "regulator: core: Limit propagation of parent voltage count and list" to the regulator tree |
| Message-ID | <tqkqC-6nm-15@gated-at.bofh.it> |
| In reply to | #1610170 |
The patch
regulator: core: Limit propagation of parent voltage count and list
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 fd086045559d90cd7854818b4c60a7119eda6231 Mon Sep 17 00:00:00 2001
From: Matthias Kaehlcke <mka@chromium.org>
Date: Mon, 27 Mar 2017 16:54:12 -0700
Subject: [PATCH] regulator: core: Limit propagation of parent voltage count
and list
Commit 26988efe11b1 ("regulator: core: Allow to get voltage count and
list from parent") introduces the propagation of the parent voltage
count and list for regulators that don't provide this information
themselves. The goal is to support simple switch regulators, however as
a side effect normal continuous regulators can leak details of their
supplies and provide consumers with inconsistent information.
Limit the propagation of the voltage count and list to switch
regulators.
Fixes: 26988efe11b1 ("regulator: core: Allow to get voltage count and
list from parent")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/core.c | 9 +++++++--
include/linux/regulator/driver.h | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c20b28a63d15..aff302dfab5d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2484,7 +2484,7 @@ static int _regulator_list_voltage(struct regulator *regulator,
ret = ops->list_voltage(rdev, selector);
if (lock)
mutex_unlock(&rdev->mutex);
- } else if (rdev->supply) {
+ } else if (rdev->is_switch && rdev->supply) {
ret = _regulator_list_voltage(rdev->supply, selector, lock);
} else {
return -EINVAL;
@@ -2542,7 +2542,7 @@ int regulator_count_voltages(struct regulator *regulator)
if (rdev->desc->n_voltages)
return rdev->desc->n_voltages;
- if (!rdev->supply)
+ if (!rdev->is_switch || !rdev->supply)
return -EINVAL;
return regulator_count_voltages(rdev->supply);
@@ -4097,6 +4097,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
mutex_unlock(®ulator_list_mutex);
}
+ if (!rdev->desc->ops->get_voltage &&
+ !rdev->desc->ops->list_voltage &&
+ !rdev->desc->fixed_uV)
+ rdev->is_switch = true;
+
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index dac8e7b16bc6..4cb1c9be6073 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -429,6 +429,8 @@ struct regulator_dev {
struct regulator_enable_gpio *ena_pin;
unsigned int ena_gpio_state:1;
+ unsigned int is_switch:1;
+
/* time when this regulator was disabled last time */
unsigned long last_off_jiffy;
};
--
2.11.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web