<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/iio/industrialio-buffer.c, branch linux-4.4.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-01-23T14:36:56+00:00</updated>
<entry>
<title>iio: buffer: Fix demux update</title>
<updated>2021-01-23T14:36:56+00:00</updated>
<author>
<name>Nuno Sá</name>
<email>nuno.sa@analog.com</email>
</author>
<published>2020-11-12T14:43:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=42a9f0387905f1aa583563d4b36b46bac542dd81'/>
<id>urn:sha1:42a9f0387905f1aa583563d4b36b46bac542dd81</id>
<content type='text'>
commit 19ef7b70ca9487773c29b449adf0c70f540a0aab upstream

When updating the buffer demux, we will skip a scan element from the
device in the case `in_ind != out_ind` and we enter the while loop.
in_ind should only be refreshed with `find_next_bit()` in the end of the
loop.

Note, to cause problems we need a situation where we are skippig over
an element (channel not enabled) that happens to not have the same size
as the next element.   Whilst this is a possible situation we haven't
actually identified any cases in mainline where it happens as most drivers
have consistent channel storage sizes with the exception of the timestamp
which is the last element and hence never skipped over.

Fixes: 5ada4ea9be16 ("staging:iio: add demux optionally to path from device to buffer")
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Link: https://lore.kernel.org/r/20201112144323.28887-1-nuno.sa@analog.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>iio: buffer: align the size of scan bytes to size of the largest element</title>
<updated>2020-01-29T09:21:52+00:00</updated>
<author>
<name>Lars Möllendorf</name>
<email>lars.moellendorf@plating.de</email>
</author>
<published>2019-12-13T13:50:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2dd55100d12c08fbabdd8ad1c18b60906fdb9d5d'/>
<id>urn:sha1:2dd55100d12c08fbabdd8ad1c18b60906fdb9d5d</id>
<content type='text'>
commit 883f616530692d81cb70f8a32d85c0d2afc05f69 upstream.

Previous versions of `iio_compute_scan_bytes` only aligned each element
to its own length (i.e. its own natural alignment). Because multiple
consecutive sets of scan elements are buffered this does not work in
case the computed scan bytes do not align with the natural alignment of
the first scan element in the set.

This commit fixes this by aligning the scan bytes to the natural
alignment of the largest scan element in the set.

Fixes: 959d2952d124 ("staging:iio: make iio_sw_buffer_preenable much more general.")
Signed-off-by: Lars Möllendorf &lt;lars.moellendorf@plating.de&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>iio: buffer: check if a buffer has been set up when poll is called</title>
<updated>2018-02-28T09:17:22+00:00</updated>
<author>
<name>Stefan Windfeldt-Prytz</name>
<email>stefan.windfeldt@axis.com</email>
</author>
<published>2018-02-15T14:02:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f4e23b43435a31f8df24a76d0b39ceac771313d4'/>
<id>urn:sha1:f4e23b43435a31f8df24a76d0b39ceac771313d4</id>
<content type='text'>
commit 4cd140bda6494543f1c1b0ccceceaa44b676eef6 upstream.

If no iio buffer has been set up and poll is called return 0.
Without this check there will be a null pointer dereference when
calling poll on a iio driver without an iio buffer.

Cc: stable@vger.kernel.org
Signed-off-by: Stefan Windfeldt-Prytz &lt;stefan.windfeldt@axis.com&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: ensure ret is initialized to zero before entering do loop</title>
<updated>2016-09-24T08:07:38+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2016-09-05T14:39:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=73c165a6f3828c61d2a0e725597ffc6e07c0c40b'/>
<id>urn:sha1:73c165a6f3828c61d2a0e725597ffc6e07c0c40b</id>
<content type='text'>
commit 5dba4b14bafe801083d01e1f400816df7e5a8f2e upstream.

A recent fix to iio_buffer_read_first_n_outer removed ret from being set by
a return from wait_event_interruptible and also added a continue in a loop
which causes the variable ret to not be set when it reaches the end of the
loop.  Fix this by initializing ret to zero.

Also remove extraneous white space at the end of the loop.

Fixes: fcf68f3c0bb2a5 ("fix sched WARNING "do not call blocking ops when !TASK_RUNNING")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"</title>
<updated>2016-09-07T06:32:41+00:00</updated>
<author>
<name>Brian Norris</name>
<email>briannorris@chromium.org</email>
</author>
<published>2016-08-09T00:19:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6cb6e951522723e17cad4419eef2cdc75c7ecc95'/>
<id>urn:sha1:6cb6e951522723e17cad4419eef2cdc75c7ecc95</id>
<content type='text'>
commit fcf68f3c0bb2a541aa47a2a38b8939edf84fd529 upstream.

When using CONFIG_DEBUG_ATOMIC_SLEEP, the scheduler nicely points out
that we're calling sleeping primitives within the wait_event loop, which
means we might clobber the task state:

[   10.831289] do not call blocking ops when !TASK_RUNNING; state=1 set at [&lt;ffffffc00026b610&gt;]
[   10.845531] ------------[ cut here ]------------
[   10.850161] WARNING: at kernel/sched/core.c:7630
...
[   12.164333] ---[ end trace 45409966a9a76438 ]---
[   12.168942] Call trace:
[   12.171391] [&lt;ffffffc00024ed44&gt;] __might_sleep+0x64/0x90
[   12.176699] [&lt;ffffffc000954774&gt;] mutex_lock_nested+0x50/0x3fc
[   12.182440] [&lt;ffffffc0007b9424&gt;] iio_kfifo_buf_data_available+0x28/0x4c
[   12.189043] [&lt;ffffffc0007b76ac&gt;] iio_buffer_ready+0x60/0xe0
[   12.194608] [&lt;ffffffc0007b7834&gt;] iio_buffer_read_first_n_outer+0x108/0x1a8
[   12.201474] [&lt;ffffffc000370d48&gt;] __vfs_read+0x58/0x114
[   12.206606] [&lt;ffffffc000371740&gt;] vfs_read+0x94/0x118
[   12.211564] [&lt;ffffffc0003720f8&gt;] SyS_read+0x64/0xb4
[   12.216436] [&lt;ffffffc000203cb4&gt;] el0_svc_naked+0x24/0x28

To avoid this, we should (a la https://lwn.net/Articles/628628/) use the
wait_woken() function, which avoids the nested sleeping while still
handling races between waiting / wake-events.

Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: fix some warning messages</title>
<updated>2015-11-21T16:00:05+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2015-11-21T10:33:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=231bfe53c57e89857753c940192acba933cba56c'/>
<id>urn:sha1:231bfe53c57e89857753c940192acba933cba56c</id>
<content type='text'>
WARN_ON() only takes a condition argument.  I have changed these to
WARN() instead.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: industrialio-buffer: Fix iio_buffer_poll return value</title>
<updated>2015-08-12T18:26:34+00:00</updated>
<author>
<name>Cristina Opriceana</name>
<email>cristina.opriceana@gmail.com</email>
</author>
<published>2015-08-03T10:37:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1bdc0293901cbea23c6dc29432e81919d4719844'/>
<id>urn:sha1:1bdc0293901cbea23c6dc29432e81919d4719844</id>
<content type='text'>
Change return value to 0 if no device is bound since
unsigned int cannot support negative error codes.

Fixes: f18e7a068 ("iio: Return -ENODEV for file operations if the
device has been unregistered")

Signed-off-by: Cristina Opriceana &lt;cristina.opriceana@gmail.com&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: buffer: Fix kernel docs warnings</title>
<updated>2015-08-02T17:27:09+00:00</updated>
<author>
<name>Cristina Opriceana</name>
<email>cristina.opriceana@gmail.com</email>
</author>
<published>2015-07-24T13:18:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0123635a77f72e0787f6f8b3ac796a40f796fcc4'/>
<id>urn:sha1:0123635a77f72e0787f6f8b3ac796a40f796fcc4</id>
<content type='text'>
Fix kernel docs for structures and functions in order to
remove some warnings when the documentation gets generated.

Signed-off-by: Cristina Opriceana &lt;cristina.opriceana@gmail.com&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: allow userspace to flush the hwfifo with non-blocking reads</title>
<updated>2015-06-21T13:51:13+00:00</updated>
<author>
<name>Octavian Purdila</name>
<email>octavian.purdila@intel.com</email>
</author>
<published>2015-06-05T12:56:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c6f67a1f55a7f8a8373068ca07553bd2b2731949'/>
<id>urn:sha1:c6f67a1f55a7f8a8373068ca07553bd2b2731949</id>
<content type='text'>
This patch changes the semantics of non-blocking reads so that a
hardware fifo flush is triggered if the available data in the device
buffer is less then the requested size.

This allows userspace to accurately generate hardware fifo flushes, by
doing a non-blocking read with a size greater then the sum of the
device buffer and hardware fifo size.

Signed-off-by: Octavian Purdila &lt;octavian.purdila@intel.com&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: Require strict scan mask matching in hardware mode</title>
<updated>2015-06-01T10:34:54+00:00</updated>
<author>
<name>Lars-Peter Clausen</name>
<email>lars@metafoo.de</email>
</author>
<published>2015-05-29T16:14:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1e1ec2861e0d4307267096c3f74c17298c1cde98'/>
<id>urn:sha1:1e1ec2861e0d4307267096c3f74c17298c1cde98</id>
<content type='text'>
In hardware mode we can not use the software demuxer, this means that the
selected scan mask needs to match one of the available scan masks exactly.

It also means that all attached buffers need to use the same scan mask.
Given that when operating in hardware mode there is typically only a single
buffer attached to the device this not an issue. Add a sanity check to make
sure that only a single buffer is attached in hardware mode nevertheless.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
</feed>
