From: Lee Jones <lee@kernel.org>
To: Maarten Zanders <maarten.zanders@mind.be>
Cc: Pavel Machek <pavel@ucw.cz>,
krzysztof.kozlowski@linaro.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] leds: lp55xx: configure internal charge pump
Date: Fri, 20 Jan 2023 16:02:31 +0000 [thread overview]
Message-ID: <Y8q7F0cDNGFeOv99@google.com> (raw)
In-Reply-To: <98a87f2d-f6c3-1dd6-36b1-095e47a87aaa@mind.be>
On Fri, 20 Jan 2023, Maarten Zanders wrote:
>
> > > + pdata->charge_pump_mode = LP55XX_CP_AUTO;
> > > + ret = of_property_read_string(np, "ti,charge-pump-mode", &pm);
> > > + if (!ret) {
> > > + for (cp_mode = LP55XX_CP_OFF;
> > > + cp_mode < ARRAY_SIZE(charge_pump_modes);
> > > + cp_mode++) {
> > > + if (!strcasecmp(pm, charge_pump_modes[cp_mode])) {
> > > + pdata->charge_pump_mode = cp_mode;
> > > + break;
> > > + }
> > > + }
> > > + }
> > A little over-engineered, no?
> >
> > Why not make the property a numerical value, then simply:
> >
> > ret = of_property_read_u32(np, "ti,charge-pump-mode", &pdata->charge_pump_mode);
> > if (ret)
> > data->charge_pump_mode = LP55XX_CP_AUTO;
> >
> > Elevates the requirement for the crumby indexed array of strings above.
> >
> > Remainder looks sane enough.
>
> Thanks for your feedback.
>
> I won't argue that your implementation isn't far more simple. The idea was
> to have an elaborate and clear and obvious devicetree, but that can also be
> achieved by moving constants into /includes/dt-bindings/leds/leds-lp55xx.h.
> Would that be more acceptable?
Yes please.
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2023-01-20 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 9:23 [PATCH v2 0/2] leds: lp55xx: configure internal charge pump Maarten Zanders
2023-01-10 9:23 ` [PATCH v2 1/2] dt-bindings: leds-lp55xx: add ti,charge-pump-mode Maarten Zanders
2023-01-10 10:24 ` Krzysztof Kozlowski
2023-01-10 9:23 ` [PATCH v2 2/2] leds: lp55xx: configure internal charge pump Maarten Zanders
2023-01-20 13:55 ` Lee Jones
2023-01-20 15:52 ` Maarten Zanders
2023-01-20 16:02 ` Lee Jones [this message]
2023-01-10 9:51 ` [PATCH v2 0/2] " Krzysztof Kozlowski
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=Y8q7F0cDNGFeOv99@google.com \
--to=lee@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=maarten.zanders@mind.be \
--cc=pavel@ucw.cz \
/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