<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/iio/industrialio-buffer.c, branch docs-6.5</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-6.5</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-6.5'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2023-02-18T14:07:58+00:00</updated>
<entry>
<title>iio: buffer: make sure O_NONBLOCK is respected</title>
<updated>2023-02-18T14:07:58+00:00</updated>
<author>
<name>Nuno Sá</name>
<email>nuno.sa@analog.com</email>
</author>
<published>2023-02-16T10:14:51+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3da1814184582ed0faf039275a3f02e6f69944ee'/>
<id>urn:sha1:3da1814184582ed0faf039275a3f02e6f69944ee</id>
<content type='text'>
For output buffers, there's no guarantee that the buffer won't be full
in the first iteration of the loop in which case we would block
independently of userspace passing O_NONBLOCK or not. Fix it by always
checking the flag before going to sleep.

While at it (and as it's a bit related), refactored the loop so that the
stop condition is 'written != n', i.e, run the loop until all data has
been copied into the IIO buffers. This makes the code a bit simpler.

Fixes: 9eeee3b0bf190 ("iio: Add output buffer support")
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Link: https://lore.kernel.org/r/20230216101452.591805-3-nuno.sa@analog.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: buffer: correctly return bytes written in output buffers</title>
<updated>2023-02-18T14:06:50+00:00</updated>
<author>
<name>Nuno Sá</name>
<email>nuno.sa@analog.com</email>
</author>
<published>2023-02-16T10:14:50+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b5184a26a28fac1d708b0bfeeb958a9260c2924c'/>
<id>urn:sha1:b5184a26a28fac1d708b0bfeeb958a9260c2924c</id>
<content type='text'>
If for some reason 'rb-&gt;access-&gt;write()' does not write the full
requested data and the O_NONBLOCK is set, we would return 'n' to
userspace which is not really truth. Hence, let's return the number of
bytes we effectively wrote.

Fixes: 9eeee3b0bf190 ("iio: Add output buffer support")
Signed-off-by: Nuno Sá &lt;nuno.sa@analog.com&gt;
Reviewed-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Link: https://lore.kernel.org/r/20230216101452.591805-2-nuno.sa@analog.com
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Don't silently expect attribute types</title>
<updated>2022-11-23T19:44:04+00:00</updated>
<author>
<name>Matti Vaittinen</name>
<email>mazziesaccount@gmail.com</email>
</author>
<published>2022-10-03T08:13:53+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=0a33755c4b01ed62a6d025cb585928304f9653d7'/>
<id>urn:sha1:0a33755c4b01ed62a6d025cb585928304f9653d7</id>
<content type='text'>
The iio_triggered_buffer_setup_ext() and the
devm_iio_kfifo_buffer_setup_ext() were changed by
commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
to silently expect that all attributes given in buffer_attrs array are
device-attributes. This expectation was not forced by the API - and some
drivers did register attributes created by IIO_CONST_ATTR().

When using IIO_CONST_ATTRs the added attribute "wrapping" does not copy
the pointer to stored string constant and when the sysfs file is read the
kernel will access to invalid location.

Change the function signatures to expect an array of iio_dev_attrs to
avoid similar errors in the future.

Merge conflict resolved whilst applying due to patch crossing with
two new drivers (kx022a accelerometer and ad4130 ADC).

Signed-off-by: Matti Vaittinen &lt;mazziesaccount@gmail.com&gt;
Tested-by: Claudiu Beznea &lt;claudiu.beznea@microchip.com&gt;
Link: https://lore.kernel.org/r/63f54787a684eb1232f1c5d275a09c786987fe4a.1664782676.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: core: move 'mlock' to 'struct iio_dev_opaque'</title>
<updated>2022-11-23T19:44:00+00:00</updated>
<author>
<name>Nuno Sá</name>
<email>nuno.sa@analog.com</email>
</author>
<published>2022-10-12T15:16:20+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=16afe125b53f88b855d2713c8ba253d905dcf3cc'/>
<id>urn:sha1:16afe125b53f88b855d2713c8ba253d905dcf3cc</id>
<content type='text'>
Now that there are no more users accessing 'mlock' directly, we can move
it to the iio_dev private structure. Hence, it's now explicit that new
driver's should not directly use this lock.

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/20221012151620.1725215-5-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Fix indentation for multiline conditional.</title>
<updated>2022-08-15T21:29:57+00:00</updated>
<author>
<name>Joe Simmons-Talbott</name>
<email>joetalbott@gmail.com</email>
</author>
<published>2022-07-27T18:18:55+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3d4b8291df3b5c9bc62ea8213b5483c4ec852947'/>
<id>urn:sha1:3d4b8291df3b5c9bc62ea8213b5483c4ec852947</id>
<content type='text'>
As reported by checkpatch.pl make indentation match previous
conditional.

Signed-off-by: Joe Simmons-Talbott &lt;joetalbott@gmail.com&gt;
Link: https://lore.kernel.org/r/20220727181855.589052-3-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Add blank lines after declarations.</title>
<updated>2022-08-15T21:29:56+00:00</updated>
<author>
<name>Joe Simmons-Talbott</name>
<email>joetalbott@gmail.com</email>
</author>
<published>2022-07-27T18:18:54+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=9d9ec8d01443832d4e6d2f46bfd6b3270f390be3'/>
<id>urn:sha1:9d9ec8d01443832d4e6d2f46bfd6b3270f390be3</id>
<content type='text'>
As reported by checkpatch.pl add blank lines after declarations.

Signed-off-by: Joe Simmons-Talbott &lt;joetalbott@gmail.com&gt;
Link: https://lore.kernel.org/r/20220727181855.589052-2-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Don't use bare "unsigned"</title>
<updated>2022-07-01T10:19:08+00:00</updated>
<author>
<name>Joe Simmons-Talbott</name>
<email>joetalbott@gmail.com</email>
</author>
<published>2022-06-24T02:18:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=abeba59f93542f57b106e8d27927d36a5b02a822'/>
<id>urn:sha1:abeba59f93542f57b106e8d27927d36a5b02a822</id>
<content type='text'>
Use "unsigned int" rather than bare "unsigned". Reported by checkpatch.pl.

Signed-off-by: Joe Simmons-Talbott &lt;joetalbott@gmail.com&gt;
Link: https://lore.kernel.org/r/20220624021806.1010962-1-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Use octal permissions and DEVICE_ATTR_{RO,RW}.</title>
<updated>2022-06-15T21:07:10+00:00</updated>
<author>
<name>Joe Simmons-Talbott</name>
<email>joetalbott@gmail.com</email>
</author>
<published>2022-06-01T18:54:14+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=9cf0b618599487f456ef5596dd30b5c162291e3c'/>
<id>urn:sha1:9cf0b618599487f456ef5596dd30b5c162291e3c</id>
<content type='text'>
As reported by checkpatch.pl.  Where possible use DEVICE_ATTR_RO(),
DEVICE_ATTR_RW(), and __ATTR_RO().  Change function names to be
&lt;var&gt;_show() for read and &lt;var&gt;_store() for write.

Suggested-by: Joe Perches &lt;joe@perches.com&gt;
Suggested-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Signed-off-by: Joe Simmons-Talbott &lt;joetalbott@gmail.com&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220601185414.251571-1-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: Replace strtobool() with kstrtobool()</title>
<updated>2022-04-28T18:22:54+00:00</updated>
<author>
<name>Lars-Peter Clausen</name>
<email>lars@metafoo.de</email>
</author>
<published>2022-04-09T10:58:12+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=74f582ec127e3b10aec71e8d15f1c14b0f0481ec'/>
<id>urn:sha1:74f582ec127e3b10aec71e8d15f1c14b0f0481ec</id>
<content type='text'>
strtobool() is deprecated and just a wrapper around kstrtobool().Replace
it with kstrtobool() so the deprecated function can be removed eventually.

Suggested-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Reviewed-by: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Link: https://lore.kernel.org/r/20220409105812.2113895-1-lars@metafoo.de
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
<entry>
<title>iio: core: Move the currentmode entry to the opaque structure</title>
<updated>2022-04-10T15:23:01+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2022-02-07T14:38:38+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=51570c9d4b3a678f77a50ac139f67290e946ec86'/>
<id>urn:sha1:51570c9d4b3a678f77a50ac139f67290e946ec86</id>
<content type='text'>
This entry should, under no situation, be modified by device
drivers. Now that we have limited its read access to device drivers
really needing it and did so through a dedicated helper, we can
easily move this variable to the opaque structure in order to
prevent any further modification from non-authorized code (out of the
core, basically).

Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Reviewed-by: Alexandru Ardelean &lt;ardeleanalex@gmail.com&gt;
Link: https://lore.kernel.org/r/20220207143840.707510-12-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
</content>
</entry>
</feed>
