iio: Handle enumerated properties with gaps
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 7 Jan 2021 11:20:49 +0000 (13:20 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 22 Jan 2021 08:52:03 +0000 (08:52 +0000)
commitd9a0e73c0c879358ca6607fad9a01248a3b27bfc
tree9866d40032c72e30042f19e241c472937127aafe
parent3cc718bc798f6dcba43fecafe2be81f0d612c56d
iio: Handle enumerated properties with gaps

Some enums might have gaps or reserved values in the middle of their value
range. E.g. consider a 2-bit enum where the values 0, 1 and 3 have a
meaning, but 2 is a reserved value and can not be used.

Add support for such enums to the IIO enum helper functions. A reserved
values is marked by setting its entry in the items array to NULL rather
than the normal descriptive string value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210107112049.10815-1-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c