From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 3/3] iio: adc: add driver for the MAX34417 Four-Channel High Dynamic Range Power Accumulator
Date: Wed, 14 Oct 2026 16:28:55 +0300 [thread overview]
Message-ID: <as-DlxY8DNaWm-PL@ashevche-desk.local> (raw)
In-Reply-To: <ba2c6e14-cb4f-47e7-92d6-7c57312daa6b@linaro.org>
On Wed, Oct 14, 2026 at 10:38:28AM +0200, Neil Armstrong wrote:
> On 10/13/26 16:53, Andy Shevchenko wrote:
> > On Tue, Oct 13, 2026 at 04:07:13PM +0200, Neil Armstrong wrote:
...
> > > +#define MAX34417_MIN_RSENSE (MILLI) /* 1 milliOhm */
> >
> > 1 * MILLI
> >
> > > +#define MAX34417_MAX_RSENSE (100 * MILLI) /* 100 milliOhm */
> > > +#define MAX34417_DEFAULT_RSENSE MAX34417_MIN_RSENSE
> >
> > I would rather put the exact value here as well.
>
> This would duplicate the value for no reason, right ?
Semantically they are different, default can be different at some point, no?
...
> > > + /* Ignore byte0 */
> > > + voltage = get_unaligned_be16(&buf[MAX34417_VOLTAGE_READ_OFFSET]);
> > > + voltage >>= 2;
> >
> > The above comment is odd. Please, clarify, ideally with a reference to
> > the datasheet table / section / et cetera.
>
> Odd ? I mean it's not, we skip byte 0 and
I don't see it. >> 2 is the same as / 4, how does this related to the byte0 skip?
> get unaligned big-endian 16bit at offset 1...
here I see what the comment is meant for. In such a case it's not odd, it's
useless. Reading the above code I don't care what offset is since it's a macro
defined constant with kinda good name already. The >> 2 is what I question here.
> > Also can be folded into a single expression:
> >
> > voltage = get_unaligned_be16(&buf[MAX34417_VOLTAGE_READ_OFFSET]) >> 2;
...
> > This can be simplified, right?
>
> I don't find this really simplified TBH, just reorganized
Triple times to have condition for label replaced with a single one sounds to
me like a simplification.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-10-14 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 14:07 [PATCH v3 0/3] iio: adc: add support for the MAX34417 Four-Channel High Dynamic Range Power Accumulator Neil Armstrong
2026-10-13 14:07 ` [PATCH v3 1/3] dt-bindings: iio: add: document " Neil Armstrong
2026-10-13 16:28 ` Conor Dooley
2026-10-14 7:34 ` Neil Armstrong
2026-10-13 14:07 ` [PATCH v3 2/3] unaligned: introduce be56 unaligned accessors Neil Armstrong
2026-10-13 14:18 ` Andy Shevchenko
2026-10-13 14:07 ` [PATCH v3 3/3] iio: adc: add driver for the MAX34417 Four-Channel High Dynamic Range Power Accumulator Neil Armstrong
2026-10-13 14:19 ` sashiko-bot
2026-10-13 14:23 ` Neil Armstrong
2026-10-13 14:53 ` Andy Shevchenko
2026-10-14 8:38 ` Neil Armstrong
2026-10-14 13:28 ` Andy Shevchenko [this message]
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=as-DlxY8DNaWm-PL@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox