summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Gupta <gauragup@cisco.com>2017-06-27 12:46:01 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-07-15 08:50:00 -0400
commitbc4b2a518f20508d866b55b5ea2739f3ced18cb6 (patch)
tree4264fffdb5ebaea77e5c7bb11a1edd835450ac6d
parent9d9ebe64dc2e1b3cb6411c817527409fe94227b1 (diff)
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: Gaurav Gupta <gauragup@cisco.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/inkern.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index a3941bade6a7..487bf6b75172 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -44,7 +44,7 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps)
44 } 44 }
45 mapi->map = &maps[i]; 45 mapi->map = &maps[i];
46 mapi->indio_dev = indio_dev; 46 mapi->indio_dev = indio_dev;
47 list_add(&mapi->l, &iio_map_list); 47 list_add_tail(&mapi->l, &iio_map_list);
48 i++; 48 i++;
49 } 49 }
50error_ret: 50error_ret: