From: David Lechner <dlechner@baylibre.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Yasin Lee" <yasin.lee.x@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] iio: proximity: hx9023s: fix scan_type endianness
Date: Tue, 22 Jul 2025 18:08:37 -0500 [thread overview]
Message-ID: <823a28d6-e612-4e32-976a-cb99945848ce@baylibre.com> (raw)
In-Reply-To: <20250722-iio-proximity-hx9023c-fix-scan_type-endianness-v1-1-48f5dc156895@baylibre.com>
On 7/22/25 6:07 PM, David Lechner wrote:
> Change the scan_type endianness from IIO_BE to IIO_LE. This matches
> the call to cpu_to_le16() in hx9023s_trigger_handler() that formats
> the data before pushing it to the IIO buffer.
>
> Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
> drivers/iio/proximity/hx9023s.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> index 33781c3147286fb3e2f022201ccf7e908d0b6b12..8e5748a5f37a7b6674acc1604710394326818204 100644
> --- a/drivers/iio/proximity/hx9023s.c
> +++ b/drivers/iio/proximity/hx9023s.c
> @@ -251,7 +251,7 @@ static const struct iio_event_spec hx9023s_events[] = {
> .sign = 's', \
> .realbits = 16, \
> .storagebits = 16, \
> - .endianness = IIO_BE, \
> + .endianness = IIO_LE, \
> }, \
> }
>
Just noticed this while reviewing scan structs.
It is odd to have data already in CPU-endian and convert it to LE
before pushing to buffers. So I'm a bit tempted to do this instead
since it probably isn't likely anyone is using this on a big-endian
system:
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 8e5748a5f37a..b8076ca4d0f4 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -145,7 +145,7 @@ struct hx9023s_data {
bool trigger_enabled;
struct {
- __le16 channels[HX9023S_CH_NUM];
+ s16 channels[HX9023S_CH_NUM];
aligned_s64 ts;
} buffer;
@@ -251,7 +251,7 @@ static const struct iio_event_spec hx9023s_events[] = {
.sign = 's', \
.realbits = 16, \
.storagebits = 16, \
- .endianness = IIO_LE, \
+ .endianness = IIO_CPU, \
}, \
}
@@ -950,7 +950,7 @@ static irqreturn_t hx9023s_trigger_handler(int irq, void *private)
iio_for_each_active_channel(indio_dev, bit) {
index = indio_dev->channels[bit].channel;
- data->buffer.channels[i++] = cpu_to_le16(data->ch_data[index].diff);
+ data->buffer.channels[i++] = data->ch_data[index].diff;
}
iio_push_to_buffers_with_ts(indio_dev, &data->buffer,
next prev parent reply other threads:[~2025-07-22 23:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 23:07 David Lechner
2025-07-22 23:08 ` David Lechner [this message]
2025-07-23 14:13 ` Andy Shevchenko
2025-07-23 14:29 ` David Lechner
2025-07-23 14:37 ` Andy Shevchenko
2025-07-23 14:57 ` David Lechner
2025-07-23 15:06 ` Andy Shevchenko
2025-07-23 15:11 ` David Lechner
2025-07-23 15:56 ` Jonathan Cameron
2025-08-25 17:07 ` David Lechner
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=823a28d6-e612-4e32-976a-cb99945848ce@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=yasin.lee.x@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
all inboxes | Powered by JetHome®