* [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation
@ 2024-09-04 19:08 Andy Shevchenko
2024-09-05 8:49 ` Chen-Yu Tsai
2024-09-05 21:51 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-09-04 19:08 UTC (permalink / raw)
To: Mark Brown, Chen-Yu Tsai, linux-kernel; +Cc: Liam Girdwood, Andy Shevchenko
Refactor of_get_*regulator() to decrease indentation and increase readability.
No functional changes intended.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/regulator/of_regulator.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index d5dd7a9e577b..3f490d81abc2 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -572,14 +572,12 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
for_each_child_of_node(parent, child) {
regnode = of_parse_phandle(child, prop_name, 0);
-
- if (!regnode) {
- regnode = of_get_child_regulator(child, prop_name);
- if (regnode)
- goto err_node_put;
- } else {
+ if (regnode)
+ goto err_node_put;
+
+ regnode = of_get_child_regulator(child, prop_name);
+ if (regnode)
goto err_node_put;
- }
}
return NULL;
@@ -607,17 +605,15 @@ static struct device_node *of_get_regulator(struct device *dev, const char *supp
snprintf(prop_name, 64, "%s-supply", supply);
regnode = of_parse_phandle(dev->of_node, prop_name, 0);
+ if (regnode)
+ return regnode;
- if (!regnode) {
- regnode = of_get_child_regulator(dev->of_node, prop_name);
- if (regnode)
- return regnode;
+ regnode = of_get_child_regulator(dev->of_node, prop_name);
+ if (regnode)
+ return regnode;
- dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
- prop_name, dev->of_node);
- return NULL;
- }
- return regnode;
+ dev_dbg(dev, "Looking up %s property in node %pOF failed\n", prop_name, dev->of_node);
+ return NULL;
}
static struct regulator_dev *of_find_regulator_by_node(struct device_node *np)
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation
2024-09-04 19:08 [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation Andy Shevchenko
@ 2024-09-05 8:49 ` Chen-Yu Tsai
2024-09-05 17:40 ` Andy Shevchenko
2024-09-05 21:51 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2024-09-05 8:49 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Mark Brown, linux-kernel, Liam Girdwood
On Thu, Sep 5, 2024 at 3:09 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> Refactor of_get_*regulator() to decrease indentation and increase readability.
> No functional changes intended.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> drivers/regulator/of_regulator.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
> index d5dd7a9e577b..3f490d81abc2 100644
> --- a/drivers/regulator/of_regulator.c
> +++ b/drivers/regulator/of_regulator.c
> @@ -572,14 +572,12 @@ static struct device_node *of_get_child_regulator(struct device_node *parent,
>
> for_each_child_of_node(parent, child) {
> regnode = of_parse_phandle(child, prop_name, 0);
> -
> - if (!regnode) {
> - regnode = of_get_child_regulator(child, prop_name);
> - if (regnode)
> - goto err_node_put;
Nit: I would probably rename this to out_node_put. But if we're going to
move to the scoped helper, we might as well just skip it.
> - } else {
> + if (regnode)
> + goto err_node_put;
> +
> + regnode = of_get_child_regulator(child, prop_name);
> + if (regnode)
> goto err_node_put;
> - }
> }
> return NULL;
>
> @@ -607,17 +605,15 @@ static struct device_node *of_get_regulator(struct device *dev, const char *supp
>
> snprintf(prop_name, 64, "%s-supply", supply);
> regnode = of_parse_phandle(dev->of_node, prop_name, 0);
> + if (regnode)
> + return regnode;
>
> - if (!regnode) {
> - regnode = of_get_child_regulator(dev->of_node, prop_name);
> - if (regnode)
> - return regnode;
> + regnode = of_get_child_regulator(dev->of_node, prop_name);
> + if (regnode)
> + return regnode;
>
> - dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
> - prop_name, dev->of_node);
> - return NULL;
> - }
> - return regnode;
> + dev_dbg(dev, "Looking up %s property in node %pOF failed\n", prop_name, dev->of_node);
> + return NULL;
> }
>
> static struct regulator_dev *of_find_regulator_by_node(struct device_node *np)
> --
> 2.46.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation
2024-09-05 8:49 ` Chen-Yu Tsai
@ 2024-09-05 17:40 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-09-05 17:40 UTC (permalink / raw)
To: Chen-Yu Tsai; +Cc: Mark Brown, linux-kernel, Liam Girdwood
On Thu, Sep 5, 2024 at 11:49 AM Chen-Yu Tsai <wenst@chromium.org> wrote:
> On Thu, Sep 5, 2024 at 3:09 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > Refactor of_get_*regulator() to decrease indentation and increase readability.
> > No functional changes intended.
> >
> > Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Thank you!
...
> > - goto err_node_put;
>
> Nit: I would probably rename this to out_node_put. But if we're going to
> move to the scoped helper, we might as well just skip it.
It's a bit out of the scope of this patch. And yes, if we go in that
direction it doesn't really matter. It will be replaced by direct
return calls anyway.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation
2024-09-04 19:08 [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation Andy Shevchenko
2024-09-05 8:49 ` Chen-Yu Tsai
@ 2024-09-05 21:51 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2024-09-05 21:51 UTC (permalink / raw)
To: Chen-Yu Tsai, linux-kernel, Andy Shevchenko; +Cc: Liam Girdwood
On Wed, 04 Sep 2024 22:08:56 +0300, Andy Shevchenko wrote:
> Refactor of_get_*regulator() to decrease indentation and increase readability.
> No functional changes intended.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation
commit: 401d078eaf2edd605c9121741e166d9326c63677
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-05 21:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 19:08 [PATCH v1 1/1] regulator: of: Refactor of_get_*regulator() to decrease indentation Andy Shevchenko
2024-09-05 8:49 ` Chen-Yu Tsai
2024-09-05 17:40 ` Andy Shevchenko
2024-09-05 21:51 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox