From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, matthias.bgg@gmail.com,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, kernel@collabora.com
Subject: Re: [PATCH v1 4/5] iio: adc: mt6359: Add support for MediaTek MT6363 PMIC AUXADC
Date: Wed, 25 Jun 2025 17:27:18 +0300 [thread overview]
Message-ID: <aFwHRigf95hPKTE7@smile.fi.intel.com> (raw)
In-Reply-To: <1b173e16-f681-4256-8dd2-92db2e90ca73@collabora.com>
On Wed, Jun 25, 2025 at 03:29:47PM +0200, AngeloGioacchino Del Regno wrote:
> Il 23/06/25 16:30, Andy Shevchenko ha scritto:
> > On Mon, Jun 23, 2025 at 02:00:27PM +0200, AngeloGioacchino Del Regno wrote:
...
> > > + if (MTK_AUXADC_HAS_FLAG(cinfo, IS_SPMI)) {
> > > + /* If the previous read succeeded, this can't fail */
> > > + regmap_read(regmap, reg - 1, &lval);
> >
> > No error check? lval may contain garbage here, right?
>
> No, because if the previous read succeeded, this can't fail, and also cannot ever
> possibly contain garbage (and if it does, - but again, that can't happen - there is
> no way to validate that because valid values are [0x00..0xff] anyway).
Never say never. Any regmap_*() call that performs I/O might fail. You can't
predict with 100% guarantee the HW behaviour in all possible scenarios.
> > > + val = (val << 8) | lval;
> >
> > Is it guaranteed that lval is always less than 256 (if unsigned)?
>
> Yes, with SPMI that is guaranteed.
>
> > > + }
...
> > > + regmap_update_bits(regmap, cinfo->regs[desc->ext_sel_idx],
> > > + MT6363_EXT_PURES_MASK, ext_sel);
> >
> > No error check?
>
> No, because if the previous reads and/or writes succeeded, it is impossible for
> this to fail :-)
Ditto.
I.o.w. the failed regmap_*() call can be a signal that something on the
communication channel with the HW went wrong, Depending on the severity of this
call the device driver may decide what to do next.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-06-25 18:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 12:00 [PATCH v1 0/5] iio: Add support for MT6363/6373 Auxiliary ADC AngeloGioacchino Del Regno
2025-06-23 12:00 ` [PATCH v1 1/5] dt-bindings: iio: adc: mt6359: Add bindings for MT6363 PMIC AuxADC AngeloGioacchino Del Regno
2025-06-27 20:02 ` Rob Herring (Arm)
2025-06-23 12:00 ` [PATCH v1 2/5] dt-bindings: iio: adc: mt6359: Add bindings for MT6373 " AngeloGioacchino Del Regno
2025-06-27 20:04 ` Rob Herring
2025-06-23 12:00 ` [PATCH v1 3/5] iio: adc: mt6359: Add ready register index and mask to channel data AngeloGioacchino Del Regno
2025-06-23 12:00 ` [PATCH v1 4/5] iio: adc: mt6359: Add support for MediaTek MT6363 PMIC AUXADC AngeloGioacchino Del Regno
2025-06-23 14:30 ` Andy Shevchenko
2025-06-25 13:29 ` AngeloGioacchino Del Regno
2025-06-25 14:27 ` Andy Shevchenko [this message]
2025-06-28 16:01 ` Jonathan Cameron
2025-07-03 13:05 ` AngeloGioacchino Del Regno
2025-06-23 12:00 ` [PATCH v1 5/5] iio: adc: mt6359: Add support for MediaTek MT6373 " AngeloGioacchino Del Regno
2025-06-24 15:08 ` [PATCH v1 0/5] iio: Add support for MT6363/6373 Auxiliary ADC Nícolas F. R. A. Prado
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=aFwHRigf95hPKTE7@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.