From: Lee Jones <lee.jones@linaro.org>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Dan Murphy <dmurphy@ti.com>, Sebastian Reichel <sre@kernel.org>,
devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/4] mfd: Add driver for Embedded Controller found on Acer Iconia Tab A500
Date: Mon, 16 Nov 2020 10:29:01 +0000 [thread overview]
Message-ID: <20201116102901.GO3718728@dell> (raw)
In-Reply-To: <0e795281-ca18-fca6-1585-a487bcfabb86@gmail.com>
On Mon, 16 Nov 2020, Dmitry Osipenko wrote:
> ...
> >>>> + while (retries-- > 0) {
> >>>> + ret = i2c_smbus_read_word_data(client, reg);
> >>>> + if (ret >= 0)
> >>>> + break;
> >>>> +
> >>>> + msleep(A500_EC_I2C_ERR_TIMEOUT);
> >>>> + }
> ...
> >>> I'm surprised there isn't a generic function which does this kind of
> >>> read. Seems like pretty common/boilerplate stuff.
> >>
> >> I'm not quite sure that this is a really very common pattern which
> >> deserves a generic helper.
> >
> > What? Read from I2C a few times, then sleep sounds like a pretty
> > common pattern to me.
>
> Maybe the read_poll_timeout() helper could be used for that, but I think
> the open-coded variant is much easier to perceive, don't you agree?
I haven't looked into it. My comment was more general in nature.
As a general rule, helpers are better than open coding, but there are
always exceptions. There may not even be a suitable helper for this
use-case. As I say, the comment was more of a passing remark.
[...]
> >> These are the values which controller's firmware wants to see, otherwise
> >> it will reject command as invalid. I'll add a clarifying comment to the
> >> code.
> >
> > Thanks. Hopefully with a bit more information as to why the firmware
> > expects to see them. Hopefully they're not random.
>
> These are the firmware-defined specific command opcodes, I'll add
> defines for them to make it more clear, thanks.
That'll do.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2020-11-16 11:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 20:33 [PATCH v5 0/4] Introduce Embedded Controller driver for Acer A500 Dmitry Osipenko
2020-11-04 20:34 ` [PATCH v5 1/4] dt-bindings: mfd: Add ENE KB930 Embedded Controller binding Dmitry Osipenko
2020-11-06 16:11 ` Rob Herring
2020-11-04 20:34 ` [PATCH v5 2/4] mfd: Add driver for Embedded Controller found on Acer Iconia Tab A500 Dmitry Osipenko
2020-11-13 9:37 ` Lee Jones
2020-11-15 23:12 ` Dmitry Osipenko
2020-11-16 8:48 ` Lee Jones
2020-11-16 9:53 ` Dmitry Osipenko
2020-11-16 10:29 ` Lee Jones [this message]
2020-11-04 20:34 ` [PATCH v5 3/4] power: supply: Add battery gauge driver for " Dmitry Osipenko
2020-11-04 20:34 ` [PATCH v5 4/4] ARM: tegra: acer-a500: Add Embedded Controller Dmitry Osipenko
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=20201116102901.GO3718728@dell \
--to=lee.jones@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=digetx@gmail.com \
--cc=dmurphy@ti.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=thierry.reding@gmail.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