提交 bc4b2a51 编写于 作者: G Gaurav Gupta 提交者: Jonathan Cameron

iio: core: Fix mapping of iio channels to entry numbers

When adding maps to the list, they were added using list_add, which adds
them in LIFO order. When parsing using iio_channel_get_all(), these
elements are hence returned in reverse order. As a result, the iio_hwmon
mapping maps the first entry to the last channel and so on.
Signed-off-by: NGaurav Gupta <gauragup@cisco.com>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 9d9ebe64
...@@ -44,7 +44,7 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps) ...@@ -44,7 +44,7 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps)
} }
mapi->map = &maps[i]; mapi->map = &maps[i];
mapi->indio_dev = indio_dev; mapi->indio_dev = indio_dev;
list_add(&mapi->l, &iio_map_list); list_add_tail(&mapi->l, &iio_map_list);
i++; i++;
} }
error_ret: error_ret:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册