All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: iio_format_list() should set stride=1 for IIO_VAL_CHAR
@ 2025-08-12 11:12 Ben Collins
  2025-08-12 14:14 ` David Lechner
  2025-08-12 20:44 ` Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Collins @ 2025-08-12 11:12 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

iio_format_list() sets a stride across the val array of 1 for INT
type, and 2 for all others. Add IIO_VAL_CHAR so it also gets a
stride of 1 assuming val is an array of integers with char type
values.

No drivers currently use this, but I found this issue adding an
avail callback for IIO_INFO_THERMOCOUPLE_TYPE for a driver I'm
working on.

Signed-off-by: Ben Collins <bcollins@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: David Lechner <dlechner@baylibre.com>
Cc: Nuno Sá <nuno.sa@analog.com>
Cc: Andy Shevchenko <andy@kernel.org>

---
 drivers/iio/industrialio-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 159d6c5ca3cec..eb6a54f8115de 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -790,6 +790,7 @@ static ssize_t iio_format_list(char *buf, const int *vals, int type, int length,
 
 	switch (type) {
 	case IIO_VAL_INT:
+	case IIO_VAL_CHAR:
 		stride = 1;
 		break;
 	default:
-- 
2.50.1

-- 
 Ben Collins
 https://libjwt.io
 https://github.com/benmcollins
 --
 3EC9 7598 1672 961A 1139  173A 5D5A 57C7 242B 22CF

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-16 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 11:12 [PATCH] iio: iio_format_list() should set stride=1 for IIO_VAL_CHAR Ben Collins
2025-08-12 14:14 ` David Lechner
2025-08-12 20:44 ` Andy Shevchenko
2025-08-13 13:15   ` Andy Shevchenko
2025-08-16 13:25     ` Jonathan Cameron

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.