iio: core: Consolidate iio_format_avail_{list,range}()
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 14 Nov 2020 11:59:59 +0000 (12:59 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Dec 2020 19:32:43 +0000 (19:32 +0000)
commiteda20ba1e25e6d8e7fa0c62d1bd685aa5de8e8ff
treee590dfb932cea6afbf3497b738ab4981daf1de2a
parent6d90c9a96e68967118149e04b7b170115866795b
iio: core: Consolidate iio_format_avail_{list,range}()

The iio_format_avail_list() and iio_format_avail_range() functions are
almost identical. The only differences are that iio_format_avail_range()
expects a fixed amount of items and adds brackets "[ ]" around the output.

Refactor them into a common helper function. This improves the
maintainability of the code as it makes it easier to modify the
implementation of these functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201114120000.6533-1-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c