From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Matti Vaittinen <matti.vaittinen@linux.dev>,
Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney@redhat.com>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-rtc@vger.kernel.org
Subject: Re: [PATCH 5/8] regulator: bd71828: Support ROHM BD73800
Date: Thu, 2 Jul 2026 07:55:48 +0300 [thread overview]
Message-ID: <96afdec2-db03-46ba-96ac-f52b13a92d5d@gmail.com> (raw)
In-Reply-To: <bf744d4f-eabe-48e7-92e4-b147b8d79d91@sirena.org.uk>
On 01/07/2026 16:01, Mark Brown wrote:
> On Wed, Jul 01, 2026 at 03:42:35PM +0300, Matti Vaittinen wrote:
>> From: Matti Vaittinen <mazziesaccount@gmail.com>
>
>> + nproot = of_get_child_by_name(nproot, "regulators");
>> + if (!nproot) {
>> + dev_err(dev, "failed to find regulators node\n");
>> + return -ENODEV;
>> + }
>> + for_each_child_of_node(nproot, np) {
>> + if (of_node_name_eq(np, LDO1_NODE_NAME))
>> + ldo1_use_high_range = of_property_read_bool(np,
>> + "rohm,ldo-range-high");
>> + if (of_node_name_eq(np, LDO3_NODE_NAME))
>> + ldo3_use_high_range = of_property_read_bool(np,
>> + "rohm,ldo-range-high");
>> + }
>
> Why do we iterate over all nodes rather than doing additional
> of_get_child_by_name()s?
This series has been sitting in my "TODO" -folder for quite a while - so
I am not anymore 100% sure as to why. I believe I've thought that the
of_get_child_by_name() does (internally) iterate all the child nodes, so
using it twice would cause code to loop through the nodes twice. So,
looping through all child nodes in a single loop probably felt like the
right thing to do. Furthermore, I've probably written the first version
before I found out the cleanup.h...
But yes. I think you're right. This can be made much leaner.
>> + if (ldo1_use_high_range) {
>> + d[BD73800_LDO1].desc.linear_ranges = bd73800_ldo13_high_volts;
>> + d[BD73800_LDO1].desc.n_linear_ranges =
>> + ARRAY_SIZE(bd73800_ldo13_high_volts);
>> + }
>> + if (ldo3_use_high_range) {
>> + d[BD73800_LDO3].desc.linear_ranges = bd73800_ldo13_high_volts;
>> + d[BD73800_LDO3].desc.n_linear_ranges =
>> + ARRAY_SIZE(bd73800_ldo13_high_volts);
>> + }
>
> You could just do these updates without the intermediate variables.
Yes.
Thanks for the suggestions! I will fix these for the v2, but it will
probably be out only during August.
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
next prev parent reply other threads:[~2026-07-02 4:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 12:40 [PATCH 0/8] Support ROHM BD73800 Matti Vaittinen
2026-07-01 12:41 ` [PATCH 1/8] dt-bindings: regulator: ROHM BD73800 regulators Matti Vaittinen
2026-07-01 15:39 ` Rob Herring (Arm)
2026-07-01 19:25 ` Rob Herring
2026-07-02 4:45 ` Matti Vaittinen
2026-07-01 12:41 ` [PATCH 2/8] dt-bindings: mfd: ROHM BD73800 PMIC Matti Vaittinen
2026-07-02 8:05 ` Krzysztof Kozlowski
2026-07-02 8:25 ` Matti Vaittinen
2026-07-03 20:46 ` Linus Walleij
2026-07-01 12:41 ` [PATCH 3/8] mfd: Support for ROHM BD73800 PMIC core Matti Vaittinen
2026-07-01 12:42 ` [PATCH 4/8] rtc: bd70528: Support RTC on ROHM BD73800 Matti Vaittinen
2026-07-01 12:55 ` Alexandre Belloni
2026-07-01 12:42 ` [PATCH 5/8] regulator: bd71828: Support " Matti Vaittinen
2026-07-01 13:01 ` Mark Brown
2026-07-02 4:55 ` Matti Vaittinen [this message]
2026-07-01 12:43 ` [PATCH 6/8] clk: bd718x7: " Matti Vaittinen
2026-07-01 12:43 ` [PATCH 7/8] gpio: bd73800: Support ROHM BD73800 PMIC GPIOs Matti Vaittinen
2026-07-03 13:11 ` Bartosz Golaszewski
2026-07-01 12:43 ` [PATCH 8/8] MAINTAINERS: Add ROHM BD73800 PMIC files Matti Vaittinen
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=96afdec2-db03-46ba-96ac-f52b13a92d5d@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=bmasney@redhat.com \
--cc=brgl@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=matti.vaittinen@linux.dev \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.