]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: iio_format_list() should set stride=1 for IIO_VAL_CHAR
authorBen Collins <bcollins@kernel.org>
Tue, 12 Aug 2025 11:12:58 +0000 (07:12 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Aug 2025 13:25:17 +0000 (14:25 +0100)
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>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/vidvwybkm3vwmtopihyaj6tlvswwa5ixmgptfzpk5ujl2ixjjb@olz6275ftabs
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c

index 159d6c5ca3cec3f5c37ee9b85ef1681cca36f5c7..eb6a54f8115dec54d284d091e35696744764ac05 100644 (file)
@@ -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: