From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: magnetometer: si7210: use devm_regulator_get_enable_read_voltage()
Date: Wed, 11 Feb 2026 10:53:48 +0200 [thread overview]
Message-ID: <aYxDnAsWLqIWEza4@smile.fi.intel.com> (raw)
In-Reply-To: <20260211081837.8169-2-antoniu.miclaus@analog.com>
On Wed, Feb 11, 2026 at 10:18:28AM +0200, Antoniu Miclaus wrote:
> Simplify probe by using devm_regulator_get_enable_read_voltage() to
> get, enable and read the regulator voltage in a single call.
One nit-pick below, otherwise LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
...
> struct si7210_data {
> struct regmap *regmap;
> struct i2c_client *client;
> - struct regulator *vdd;
> struct mutex fetch_lock; /* lock for a single measurement fetch */
> s8 temp_offset;
> s8 temp_gain;
> s8 scale_20_a[A_REGS_COUNT];
> s8 scale_200_a[A_REGS_COUNT];
> u8 curr_scale;
> + unsigned int vdd_uV;
> };
Haven't noticed, but I believe this is not the best place to put a new member.
Does `pahole` agree with me or with you?
...
> /* temp -= 0.222 * VDD */
> - temp -= 222 * div_s64(ret, MILLI);
> + temp -= 222 * (data->vdd_uV / MILLI);
Just a side note: Here is a possible loss in precision, wouldn't be better to
have it as
temp -= 222 * data->vdd_uV / MILLI;
?
Note, if you agree this needs to be checked with the datasheet, etc. and sent
in a separate patch. For now the original way seems okay to me.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-02-11 8:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 8:18 [PATCH v2] iio: magnetometer: si7210: use devm_regulator_get_enable_read_voltage() Antoniu Miclaus
2026-02-11 8:53 ` Andy Shevchenko [this message]
2026-02-14 19:32 ` Jonathan Cameron
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=aYxDnAsWLqIWEza4@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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