From: Gaurav Gupta Date: Tue, 27 Jun 2017 16:46:01 +0000 (-0700) Subject: iio: core: Fix mapping of iio channels to entry numbers X-Git-Tag: v4.14-rc1~148^2~364^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc4b2a518f20508d866b55b5ea2739f3ced18cb6;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index a3941ba..487bf6b 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) } mapi->map = &maps[i]; mapi->indio_dev = indio_dev; - list_add(&mapi->l, &iio_map_list); + list_add_tail(&mapi->l, &iio_map_list); i++; } error_ret: