<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/iio/inkern.c, branch linux-5.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-10-24T07:57:47Z</updated>
<entry>
<title>iio: inkern: fix return value in devm_of_iio_channel_get_by_name()</title>
<updated>2022-10-24T07:57:47Z</updated>
<author>
<name>Nuno Sá</name>
</author>
<published>2022-07-15T12:28:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=144ef27e46e077c444709a5dc2e5d58fe99d7825'/>
<id>urn:sha1:144ef27e46e077c444709a5dc2e5d58fe99d7825</id>
<content type='text'>
[ Upstream commit 9e878dbc0e8322f8b2f5ab0093c1e89926362dbe ]

of_iio_channel_get_by_name() can either return NULL or an error pointer
so that only doing IS_ERR() is not enough. Fix it by checking the NULL
pointer case and return -ENODEV in that case. Note this is done like this
so that users of the function (which only check for error pointers) do
not need to be changed. This is not ideal since we are losing error codes
and as such, in a follow up change, things will be unified so that
of_iio_channel_get_by_name() only returns error codes.

Fixes: 6e39b145cef7 ("iio: provide of_iio_channel_get_by_name() and devm_ version it")
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220715122903.332535-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: inkern: only release the device node when done with it</title>
<updated>2022-10-24T07:57:47Z</updated>
<author>
<name>Nuno Sá</name>
</author>
<published>2022-07-15T12:28:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e416e52185f507740706c519a01ebd376847332'/>
<id>urn:sha1:4e416e52185f507740706c519a01ebd376847332</id>
<content type='text'>
[ Upstream commit 79c3e84874c7d14f04ad58313b64955a0d2e9437 ]

'of_node_put()' can potentially release the memory pointed to by
'iiospec.np' which would leave us with an invalid pointer (and we would
still pass it in 'of_xlate()'). Note that it is not guaranteed for the
of_node lifespan to be attached to the device (to which is attached)
lifespan so that there is (even though very unlikely) the possibility
for the node to be freed while the device is still around. Thus, as there
are indeed some of_xlate users which do access the node, a race is indeed
possible.

As such, we can only release the node after we are done with it.

Fixes: 17d82b47a215d ("iio: Add OF support")
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Link: https://lore.kernel.org/r/20220715122903.332535-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: inkern: make a best effort on offset calculation</title>
<updated>2022-01-30T14:38:03Z</updated>
<author>
<name>Liam Beguin</name>
</author>
<published>2022-01-08T20:53:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ca85123354e1a65a22170286387b4791997fe864'/>
<id>urn:sha1:ca85123354e1a65a22170286387b4791997fe864</id>
<content type='text'>
iio_convert_raw_to_processed_unlocked() assumes the offset is an
integer. Make a best effort to get a valid offset value for fractional
cases without breaking implicit truncations.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Liam Beguin &lt;liambeguin@gmail.com&gt;
Reviewed-by: Peter Rosin &lt;peda@axentia.se&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220108205319.2046348-4-liambeguin@gmail.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: inkern: apply consumer scale when no channel scale is available</title>
<updated>2022-01-30T14:38:03Z</updated>
<author>
<name>Liam Beguin</name>
</author>
<published>2022-01-08T20:53:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=14b457fdde38de594a4bc4bd9075019319d978da'/>
<id>urn:sha1:14b457fdde38de594a4bc4bd9075019319d978da</id>
<content type='text'>
When a consumer calls iio_read_channel_processed() and no channel scale
is available, it's assumed that the scale is one and the raw value is
returned as expected.

On the other hand, if the consumer calls iio_convert_raw_to_processed()
the scaling factor requested by the consumer is not applied.

This for example causes the consumer to process mV when expecting uV.
Make sure to always apply the scaling factor requested by the consumer.

Fixes: adc8ec5ff183 ("iio: inkern: pass through raw values if no scaling")
Signed-off-by: Liam Beguin &lt;liambeguin@gmail.com&gt;
Reviewed-by: Peter Rosin &lt;peda@axentia.se&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220108205319.2046348-3-liambeguin@gmail.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: inkern: apply consumer scale on IIO_VAL_INT cases</title>
<updated>2022-01-30T14:37:47Z</updated>
<author>
<name>Liam Beguin</name>
</author>
<published>2022-01-08T20:53:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bca97ff95c732a516ebb68da72814194980e0a5'/>
<id>urn:sha1:1bca97ff95c732a516ebb68da72814194980e0a5</id>
<content type='text'>
When a consumer calls iio_read_channel_processed() and the channel has
an integer scale, the scale channel scale is applied and the processed
value is returned as expected.

On the other hand, if the consumer calls iio_convert_raw_to_processed()
the scaling factor requested by the consumer is not applied.

This for example causes the consumer to process mV when expecting uV.
Make sure to always apply the scaling factor requested by the consumer.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Liam Beguin &lt;liambeguin@gmail.com&gt;
Reviewed-by: Peter Rosin &lt;peda@axentia.se&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220108205319.2046348-2-liambeguin@gmail.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: inkern: introduce devm_iio_map_array_register() short-hand function</title>
<updated>2021-10-19T07:27:34Z</updated>
<author>
<name>Alexandru Ardelean</name>
</author>
<published>2021-09-03T07:29:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=25c02edfd41f0dd7aad9115149625d7e7f441b7d'/>
<id>urn:sha1:25c02edfd41f0dd7aad9115149625d7e7f441b7d</id>
<content type='text'>
This change introduces a device-managed variant to the
iio_map_array_register() function. It's a simple implementation of calling
iio_map_array_register() and registering a callback to
iio_map_array_unregister() with the devm_add_action_or_reset().

The function uses an explicit 'dev' parameter to bind the unwinding to. It
could have been implemented to implicitly use the parent of the IIO device,
however it shouldn't be too expensive to callers to just specify to which
device object to bind this unwind call.
It would make the API a bit more flexible.

Signed-off-by: Alexandru Ardelean &lt;aardelean@deviqon.com&gt;
Link: https://lore.kernel.org/r/20210903072917.45769-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: core: move @info_exist_lock to struct iio_dev_opaque</title>
<updated>2021-05-17T12:49:13Z</updated>
<author>
<name>Jonathan Cameron</name>
</author>
<published>2021-04-26T17:49:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b804e2b76ac6d5559b99588e0190ac97b5597497'/>
<id>urn:sha1:b804e2b76ac6d5559b99588e0190ac97b5597497</id>
<content type='text'>
This lock is only of interest to the IIO core, so make it only
visible there.

Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Reviewed-by: Alexandru Ardelean &lt;ardeleanalex@gmail.com&gt;
Link: https://lore.kernel.org/r/20210426174911.397061-7-jic23@kernel.org
</content>
</entry>
<entry>
<title>iio: inkern: simplify some devm functions</title>
<updated>2021-05-17T12:49:07Z</updated>
<author>
<name>Yicong Yang</name>
</author>
<published>2021-04-08T11:38:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7349e8a36caa11c07e71b05f42c384bc540446c8'/>
<id>urn:sha1:7349e8a36caa11c07e71b05f42c384bc540446c8</id>
<content type='text'>
Use devm_add_action_or_reset() instead of devres_alloc() and
devres_add(), which works the same. This will simplify the
code. There is no functional changes.

Signed-off-by: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Reviewed-by: Nuno Sa &lt;nuno.sa@analog.com&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/1617881896-3164-8-git-send-email-yangyicong@hisilicon.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Fix iio_read_channel_processed_scale()</title>
<updated>2021-04-07T07:35:51Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2021-03-23T12:27:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b3b64e2c1575da5f290e75e2a1d9cac307812222'/>
<id>urn:sha1:b3b64e2c1575da5f290e75e2a1d9cac307812222</id>
<content type='text'>
The code was checking if (ret) from the processed
channel readout, not smart, we need to check if (ret &lt; 0)
as this will likely be something like IIO_VAL_INT.

Fixes: 635ef601b238 ("iio: Provide iio_read_channel_processed_scale() API")
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Link: https://lore.kernel.org/r/20210323122705.1326362-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Provide iio_read_channel_processed_scale() API</title>
<updated>2021-03-25T19:13:51Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2021-03-08T10:02:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=635ef601b2387c3215252c9931786524d122c0e7'/>
<id>urn:sha1:635ef601b2387c3215252c9931786524d122c0e7</id>
<content type='text'>
Since the old iio_read_channel_processed() would
lose precision if we fall back to reading raw and
scaling, we introduce a new API that will pass in
a scale factor when reading a processed channel:
iio_read_channel_processed_scale().

Refactor iio_read_channel_processed() as a special
case with scale factor 1.

Cc: Peter Rosin &lt;peda@axentia.se&gt;
Cc: Chris Lesiak &lt;chris.lesiak@licor.com&gt;
Cc: Jonathan Cameron &lt;jic23@kernel.org&gt;
Cc: linux-iio@vger.kernel.org
Link: https://lore.kernel.org/linux-iio/20201224011607.1059534-1-linus.walleij@linaro.org/
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Link: https://lore.kernel.org/r/20210308100219.2732156-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
</feed>
