From: sashiko-bot@kernel.org
To: "David Lechner (TI)" <dlechner@baylibre.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 7/8] iio: adc: ti-ads112c14: implement gain on internal short SYS_MON channel
Date: Fri, 10 Jul 2026 23:04:18 +0000 [thread overview]
Message-ID: <20260710230419.12E3B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260710-iio-adc-ti-ads122c14-v3-7-746d52cbf1d0@baylibre.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `read_avail` callback incorrectly casts a native `s64` array to `const int *` for the IIO core, which corrupts scale values on big-endian architectures.
--
--- Patch [7]: [PATCH v3 7/8] iio: adc: ti-ads112c14: implement gain on internal short SYS_MON channel ---
commit 6c0e6ddc837dab31f5440831baff3fcb1a43f658
Author: David Lechner (TI) <dlechner@baylibre.com>
iio: adc: ti-ads112c14: implement gain on internal short SYS_MON channel
This commit implements support for the programmable gain amplifier on the
internal short SYS_MON channel. The scale_available table is populated
during probe to allow the PGA to be set to the same gain as external
channels.
> diff --git a/drivers/iio/adc/ti-ads112c14.c b/drivers/iio/adc/ti-ads112c14.c
> index 4d2e7d37be829..2ce4411a0d86f 100644
> --- a/drivers/iio/adc/ti-ads112c14.c
> +++ b/drivers/iio/adc/ti-ads112c14.c
[ ... ]
> @@ -402,6 +430,69 @@ static int ads112c14_read_raw(struct iio_dev *indio_dev,
> }
> }
>
> +static int ads112c14_read_avail(struct iio_dev *indio_dev,
> + const struct iio_chan_spec *chan, const int **vals,
> + int *type, int *length, long mask)
> +{
> + struct ads112c14_data *data = iio_priv(indio_dev);
> +
> + if (chan->channel == ADS112C14_SYS_MON_CHANNEL_SHORT) {
> + *vals = (const int *)data->sys_mon_chan_short_scale_available;
> + *length = 2 * ARRAY_SIZE(data->sys_mon_chan_short_scale_available);
> + *type = IIO_VAL_DECIMAL64_PICO;
[Severity: Medium]
Does casting a native s64 array to a const int pointer corrupt the scale
values on big-endian architectures?
When the IIO core processes these values as 32-bit pairs, vals[0] becomes
the most significant 32 bits and vals[1] the least significant on big-endian
systems. If the core later composes this via iio_val_s64_compose(vals[0],
vals[1]), the halves will be swapped, resulting in a mangled 64-bit scale
value.
Should the driver explicitly decompose the 64-bit values into an integer
array before handing them to the IIO core to avoid endianness issues?
> + return IIO_AVAIL_LIST;
> + }
> +
> + return -EINVAL;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710-iio-adc-ti-ads122c14-v3-0-746d52cbf1d0@baylibre.com?part=7
next prev parent reply other threads:[~2026-07-10 23:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 22:50 [PATCH v3 0/8] iio: adc: new ti-ads112c14 driver David Lechner
2026-07-10 22:50 ` [PATCH v3 1/8] dt-bindings: iio: adc: Add reference-sources property David Lechner
2026-07-10 22:50 ` [PATCH v3 2/8] dt-bindings: iio: adc: Add excitation current sources properties David Lechner
2026-07-13 1:32 ` Jonathan Cameron
2026-07-10 22:50 ` [PATCH v3 3/8] dt-bindings: iio: adc: Add burn-out current properties David Lechner
2026-07-10 22:50 ` [PATCH v3 4/8] dt-bindings: iio: adc: add input-chopping property David Lechner (TI)
2026-07-13 1:34 ` Jonathan Cameron
2026-07-13 14:55 ` David Lechner
2026-07-13 15:24 ` Jonathan Cameron
2026-07-13 16:29 ` Conor Dooley
2026-07-10 22:50 ` [PATCH v3 5/8] dt-bindings: iio: adc: add ti,ads122c14 David Lechner (TI)
2026-07-10 22:59 ` sashiko-bot
2026-07-10 23:12 ` David Lechner
2026-07-13 1:54 ` Jonathan Cameron
2026-07-13 16:28 ` Conor Dooley
2026-07-10 22:50 ` [PATCH v3 6/8] iio: adc: add ti-ads112c14 driver David Lechner (TI)
2026-07-10 23:00 ` sashiko-bot
2026-07-12 9:42 ` Andy Shevchenko
2026-07-12 16:30 ` David Lechner
2026-07-13 2:11 ` Jonathan Cameron
2026-07-13 14:03 ` David Lechner
2026-07-10 22:50 ` [PATCH v3 7/8] iio: adc: ti-ads112c14: implement gain on internal short SYS_MON channel David Lechner (TI)
2026-07-10 23:04 ` sashiko-bot [this message]
2026-07-11 9:11 ` Andy Shevchenko
2026-07-13 2:21 ` Jonathan Cameron
2026-07-10 22:50 ` [PATCH v3 8/8] iio: adc: ti-ads112c14: add measurement channel support David Lechner (TI)
2026-07-10 23:08 ` sashiko-bot
2026-07-11 13:00 ` Andy Shevchenko
2026-07-13 19:40 ` David Lechner
2026-07-14 1:04 ` Andy Shevchenko
2026-07-13 2:35 ` 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=20260710230419.12E3B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.