From: jerome Neanne <jneanne@baylibre.com>
To: andy.shevchenko@gmail.com, Esteban Blanc <eblanc@baylibre.com>
Cc: linus.walleij@linaro.org, lgirdwood@gmail.com,
broonie@kernel.org, a.zummo@towertech.it,
alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org,
jpanis@baylibre.com, aseketeli@baylibre.com, u-kumar1@ti.com
Subject: Re: [PATCH v5 3/3] regulator: tps6594-regulator: Add driver for TI TPS6594 regulators
Date: Wed, 7 Jun 2023 13:44:46 +0200 [thread overview]
Message-ID: <613601c2-cc98-526b-a9e3-2ad2abc68e1d@baylibre.com> (raw)
In-Reply-To: <ZG0VHnEByyMW9i4a@surfacebook>
>
>> + enum {
>> + MULTI_BUCK12,
>> + MULTI_BUCK123,
>> + MULTI_BUCK1234,
>> + MULTI_BUCK12_34,
>
>> + MULTI_FIRST = MULTI_BUCK12,
>> + MULTI_LAST = MULTI_BUCK12_34,
>> + MULTI_NUM = MULTI_LAST - MULTI_FIRST + 1
>
> MULT_NUM
>
> will suffice instead all this.
>
>> + };
>
> But why enum at all? See below.
Just for the switch case readability.
I have to iterate across the multiphases array for look up name into
device tree and evaluate in that order.
This can be reduced to:
enum {
MULTI_BUCK12,
MULTI_BUCK123,
MULTI_BUCK1234,
MULTI_BUCK12_34,
MULTI_NUM = MULTI_BUCK12_34 - MULTI_BUCK12 + 1
};
>
> ...
>
>> + /*
>> + * Switch case defines different possible multi phase config
>> + * This is based on dts buck node name.
>> + * Buck node name must be chosen accordingly.
>> + * Default case is no Multiphase buck.
>> + * In case of Multiphase configuration, value should be defined for
>> + * buck_configured to avoid creating bucks for every buck in multiphase
>> + */
>> + for (multi = MULTI_FIRST; multi < MULTI_NUM; multi++) {
>> + np = of_find_node_by_name(tps->dev->of_node, multiphases[multi]);
>> + npname = of_node_full_name(np);
>> + np_pmic_parent = of_get_parent(of_get_parent(np));
>> + if (of_node_cmp(of_node_full_name(np_pmic_parent), tps->dev->of_node->full_name))
>
> Why not of_node_full_name() in the second case?
Sure.
>
>
>> + continue;
>> + delta = strcmp(npname, multiphases[multi]);
>> + if (!delta) {
>> + switch (multi) {
>> + case MULTI_BUCK12:
>
> This all looks like match_string() reinvention.
I can go with match_string but this is not significantly changing the game:
index = match_string(multiphases, ARRAY_SIZE(multiphases), npname);
if (index >= 0) {
switch (index) {
No question on all your other feedback. Just wondering if I missed
something with match_string use. Looks like a good idea indeed but this
is not drastically changing the code as you seem to expect... Let me
know if you think I'm doing it in a wrong way.
Regards,
Jerome.
next prev parent reply other threads:[~2023-06-07 11:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 16:31 [PATCH v5 0/3] TI TPS6594 PMIC support (RTC, pinctrl, regulators) Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 1/3] rtc: tps6594: Add driver for TPS6594 RTC Esteban Blanc
2023-05-23 13:36 ` andy.shevchenko
2023-05-23 14:32 ` Alexandre Belloni
2023-05-25 13:56 ` Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 2/3] pinctrl: tps6594: Add driver for TPS6594 pinctrl and GPIOs Esteban Blanc
2023-05-23 19:14 ` andy.shevchenko
2023-05-25 14:07 ` Esteban Blanc
2023-05-26 18:43 ` Andy Shevchenko
2023-05-31 7:58 ` Esteban Blanc
2023-05-22 16:31 ` [PATCH v5 3/3] regulator: tps6594-regulator: Add driver for TI TPS6594 regulators Esteban Blanc
2023-05-23 19:33 ` andy.shevchenko
2023-06-07 11:44 ` jerome Neanne [this message]
2023-06-07 14:52 ` Andy Shevchenko
2023-06-06 16:51 ` [PATCH v5 0/3] TI TPS6594 PMIC support (RTC, pinctrl, regulators) Mark Brown
2023-06-07 12:40 ` (subset) " Mark Brown
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=613601c2-cc98-526b-a9e3-2ad2abc68e1d@baylibre.com \
--to=jneanne@baylibre.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=andy.shevchenko@gmail.com \
--cc=aseketeli@baylibre.com \
--cc=broonie@kernel.org \
--cc=eblanc@baylibre.com \
--cc=jpanis@baylibre.com \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=u-kumar1@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®