* [PATCH] iio: core: Fix mapping of iio channels to entry numbers
@ 2017-06-27 16:46 Gaurav Gupta
2017-07-01 17:40 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Gaurav Gupta @ 2017-06-27 16:46 UTC (permalink / raw)
To: jic23, knaack.h, lars, pmeerw, linux-iio
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>
---
drivers/iio/inkern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 7a13535..9b0715c 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:
--
2.10.2.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: core: Fix mapping of iio channels to entry numbers
2017-06-27 16:46 [PATCH] iio: core: Fix mapping of iio channels to entry numbers Gaurav Gupta
@ 2017-07-01 17:40 ` Jonathan Cameron
2017-07-01 18:46 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2017-07-01 17:40 UTC (permalink / raw)
To: Gaurav Gupta; +Cc: knaack.h, lars, pmeerw, linux-iio, Guenter Roeck
On Tue, 27 Jun 2017 09:46:01 -0700
Gaurav Gupta <gauragup@cisco.com> wrote:
> 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>
Gah. This is one of those nasty cases where I clearly messed up a
long time ago, but unfortunately it's become user space ABI.
So looking for general opinions on whether we can fix this one
or not. I can't immediately think of a clean way to tidy this up.
So do we think people will notice if we fix this?
Jonathan
> ---
> drivers/iio/inkern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 7a13535..9b0715c 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:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: core: Fix mapping of iio channels to entry numbers
2017-07-01 17:40 ` Jonathan Cameron
@ 2017-07-01 18:46 ` Guenter Roeck
2017-07-14 16:51 ` Gaurav Gupta (gauragup)
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-07-01 18:46 UTC (permalink / raw)
To: Jonathan Cameron, Gaurav Gupta; +Cc: knaack.h, lars, pmeerw, linux-iio
On 07/01/2017 10:40 AM, Jonathan Cameron wrote:
> On Tue, 27 Jun 2017 09:46:01 -0700
> Gaurav Gupta <gauragup@cisco.com> wrote:
>
>> 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>
> Gah. This is one of those nasty cases where I clearly messed up a
> long time ago, but unfortunately it's become user space ABI.
>
> So looking for general opinions on whether we can fix this one
> or not. I can't immediately think of a clean way to tidy this up.
>
> So do we think people will notice if we fix this?
>
I would just go for it.
Guenter
> Jonathan
>> ---
>> drivers/iio/inkern.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
>> index 7a13535..9b0715c 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:
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: core: Fix mapping of iio channels to entry numbers
2017-07-01 18:46 ` Guenter Roeck
@ 2017-07-14 16:51 ` Gaurav Gupta (gauragup)
2017-07-15 12:51 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Gaurav Gupta (gauragup) @ 2017-07-14 16:51 UTC (permalink / raw)
To: Guenter Roeck, Jonathan Cameron
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
linux-iio@vger.kernel.org
SGkgSm9uYXRoYW4sDQoNCkp1c3Qgd29uZGVyaW5nIGlmIHlvdSBmb3Jlc2VlIGFueSBpc3N1ZXMg
d2l0aCB0aGlzIGNoYW5nZSBvciBhbnkgZnVydGhlciBjaGFuZ2VzIHRoYXQgbmVlZCB0byBoYXBw
ZW4gYXMgYSBzaWRlLWVmZmVjdCBvZiB0aGlzPw0KDQpUaGFua3MsDQpHYXVyYXYNCg0KT24gNy8x
LzE3LCAxMTo0NiBBTSwgImxpbnV4LWlpby1vd25lckB2Z2VyLmtlcm5lbC5vcmcgb24gYmVoYWxm
IG9mIEd1ZW50ZXIgUm9lY2siIDxsaW51eC1paW8tb3duZXJAdmdlci5rZXJuZWwub3JnIG9uIGJl
aGFsZiBvZiBsaW51eEByb2Vjay11cy5uZXQ+IHdyb3RlOg0KDQogICAgT24gMDcvMDEvMjAxNyAx
MDo0MCBBTSwgSm9uYXRoYW4gQ2FtZXJvbiB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0OiBzZW5kIHRoZSBsaW5lICJ1
bnN1YnNjcmliZSBsaW51eC1paW8iIGluDQogICAgdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRvIG1h
am9yZG9tb0B2Z2VyLmtlcm5lbC5vcmcNCiAgICBNb3JlIG1ham9yZG9tbyBpbmZvIGF0ICBodHRw
Oi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwNCiAgICANCg0K
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: core: Fix mapping of iio channels to entry numbers
2017-07-14 16:51 ` Gaurav Gupta (gauragup)
@ 2017-07-15 12:51 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2017-07-15 12:51 UTC (permalink / raw)
To: Gaurav Gupta (gauragup)
Cc: Guenter Roeck, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, linux-iio@vger.kernel.org
On Fri, 14 Jul 2017 16:51:12 +0000
"Gaurav Gupta (gauragup)" <gauragup@cisco.com> wrote:
> Hi Jonathan,
>
> Just wondering if you foresee any issues with this change or any further changes that need to happen as a side-effect of this?
This still makes me nervous so I'm going to take the cautious route of pushing it
out via the slow path of the next merge window. If no one shouts for a month
or so after that, we can request a backport to stable.
So applied to the togreg branch of iio.git.
Jonathan
>
> Thanks,
> Gaurav
>
> On 7/1/17, 11:46 AM, "linux-iio-owner@vger.kernel.org on behalf of Guenter Roeck" <linux-iio-owner@vger.kernel.org on behalf of linux@roeck-us.net> wrote:
>
> On 07/01/2017 10:40 AM, Jonathan Cameron wrote:
> > On Tue, 27 Jun 2017 09:46:01 -0700
> > Gaurav Gupta <gauragup@cisco.com> wrote:
> >
> >> 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>
> > Gah. This is one of those nasty cases where I clearly messed up a
> > long time ago, but unfortunately it's become user space ABI.
> >
> > So looking for general opinions on whether we can fix this one
> > or not. I can't immediately think of a clean way to tidy this up.
> >
> > So do we think people will notice if we fix this?
> >
>
> I would just go for it.
>
> Guenter
>
> > Jonathan
> >> ---
> >> drivers/iio/inkern.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> >> index 7a13535..9b0715c 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:
> >
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-15 12:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 16:46 [PATCH] iio: core: Fix mapping of iio channels to entry numbers Gaurav Gupta
2017-07-01 17:40 ` Jonathan Cameron
2017-07-01 18:46 ` Guenter Roeck
2017-07-14 16:51 ` Gaurav Gupta (gauragup)
2017-07-15 12:51 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).