* [PATCH 1/2] regulator: fixed: use local device_node reference
@ 2022-06-16 14:07 Marco Felsch
2022-06-16 14:07 ` [PATCH 2/2] regulator: fixed: add off-on-delay-us device-tree parsing support Marco Felsch
2022-06-17 7:27 ` [PATCH 1/2] regulator: fixed: use local device_node reference Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Marco Felsch @ 2022-06-16 14:07 UTC (permalink / raw)
To: barebox
Just a cosmetic commit, no functional changes. Use a local variable for
the device_node instead of dereference the pointer multiple times.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/regulator/fixed.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index f068fded62..9c660d5781 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -50,6 +50,7 @@ const static struct regulator_ops fixed_ops = {
static int regulator_fixed_probe(struct device_d *dev)
{
+ struct device_node *np = dev->device_node;
struct regulator_fixed *fix;
int ret;
@@ -59,7 +60,7 @@ static int regulator_fixed_probe(struct device_d *dev)
fix = xzalloc(sizeof(*fix));
fix->gpio = -EINVAL;
- if (of_get_property(dev->device_node, "gpio", NULL)) {
+ if (of_get_property(np, "gpio", NULL)) {
fix->gpio = gpiod_get(dev, NULL, GPIOD_ASIS);
if (fix->gpio < 0) {
ret = fix->gpio;
@@ -71,13 +72,13 @@ static int regulator_fixed_probe(struct device_d *dev)
fix->rdev.desc = &fix->rdesc;
fix->rdev.dev = dev;
- if (of_find_property(dev->device_node, "regulator-always-on", NULL) ||
- of_find_property(dev->device_node, "regulator-boot-on", NULL)) {
+ if (of_find_property(np, "regulator-always-on", NULL) ||
+ of_find_property(np, "regulator-boot-on", NULL)) {
fix->always_on = 1;
regulator_fixed_enable(&fix->rdev);
}
- ret = of_regulator_register(&fix->rdev, dev->device_node);
+ ret = of_regulator_register(&fix->rdev, np);
if (ret)
return ret;
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] regulator: fixed: add off-on-delay-us device-tree parsing support
2022-06-16 14:07 [PATCH 1/2] regulator: fixed: use local device_node reference Marco Felsch
@ 2022-06-16 14:07 ` Marco Felsch
2022-06-17 7:27 ` [PATCH 1/2] regulator: fixed: use local device_node reference Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Marco Felsch @ 2022-06-16 14:07 UTC (permalink / raw)
To: barebox
The core already handles the off_on_delay if we set it. So parse the
official device-tree property and set it if present.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/regulator/fixed.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 9c660d5781..ae16df8a0c 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -52,6 +52,7 @@ static int regulator_fixed_probe(struct device_d *dev)
{
struct device_node *np = dev->device_node;
struct regulator_fixed *fix;
+ u32 delay;
int ret;
if (!dev->device_node)
@@ -72,6 +73,9 @@ static int regulator_fixed_probe(struct device_d *dev)
fix->rdev.desc = &fix->rdesc;
fix->rdev.dev = dev;
+ if (!of_property_read_u32(np, "off-on-delay-us", &delay))
+ fix->rdesc.off_on_delay = delay;
+
if (of_find_property(np, "regulator-always-on", NULL) ||
of_find_property(np, "regulator-boot-on", NULL)) {
fix->always_on = 1;
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] regulator: fixed: use local device_node reference
2022-06-16 14:07 [PATCH 1/2] regulator: fixed: use local device_node reference Marco Felsch
2022-06-16 14:07 ` [PATCH 2/2] regulator: fixed: add off-on-delay-us device-tree parsing support Marco Felsch
@ 2022-06-17 7:27 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-06-17 7:27 UTC (permalink / raw)
To: Marco Felsch; +Cc: barebox
On Thu, Jun 16, 2022 at 04:07:36PM +0200, Marco Felsch wrote:
> Just a cosmetic commit, no functional changes. Use a local variable for
> the device_node instead of dereference the pointer multiple times.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/regulator/fixed.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index f068fded62..9c660d5781 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -50,6 +50,7 @@ const static struct regulator_ops fixed_ops = {
>
> static int regulator_fixed_probe(struct device_d *dev)
> {
> + struct device_node *np = dev->device_node;
> struct regulator_fixed *fix;
> int ret;
>
> @@ -59,7 +60,7 @@ static int regulator_fixed_probe(struct device_d *dev)
> fix = xzalloc(sizeof(*fix));
> fix->gpio = -EINVAL;
>
> - if (of_get_property(dev->device_node, "gpio", NULL)) {
> + if (of_get_property(np, "gpio", NULL)) {
> fix->gpio = gpiod_get(dev, NULL, GPIOD_ASIS);
> if (fix->gpio < 0) {
> ret = fix->gpio;
> @@ -71,13 +72,13 @@ static int regulator_fixed_probe(struct device_d *dev)
> fix->rdev.desc = &fix->rdesc;
> fix->rdev.dev = dev;
>
> - if (of_find_property(dev->device_node, "regulator-always-on", NULL) ||
> - of_find_property(dev->device_node, "regulator-boot-on", NULL)) {
> + if (of_find_property(np, "regulator-always-on", NULL) ||
> + of_find_property(np, "regulator-boot-on", NULL)) {
> fix->always_on = 1;
> regulator_fixed_enable(&fix->rdev);
> }
>
> - ret = of_regulator_register(&fix->rdev, dev->device_node);
> + ret = of_regulator_register(&fix->rdev, np);
> if (ret)
> return ret;
>
> --
> 2.30.2
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-17 7:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 14:07 [PATCH 1/2] regulator: fixed: use local device_node reference Marco Felsch
2022-06-16 14:07 ` [PATCH 2/2] regulator: fixed: add off-on-delay-us device-tree parsing support Marco Felsch
2022-06-17 7:27 ` [PATCH 1/2] regulator: fixed: use local device_node reference Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox