linux/drivers/iio
Brian Norris 6cb6e95152 iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"
commit fcf68f3c0b 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 [<ffffffc00026b610>]
[   10.845531] ------------[ cut here ]------------
[   10.850161] WARNING: at kernel/sched/core.c:7630
...
[   12.164333] ---[ end trace 45409966a9a76438 ]---
[   12.168942] Call trace:
[   12.171391] [<ffffffc00024ed44>] __might_sleep+0x64/0x90
[   12.176699] [<ffffffc000954774>] mutex_lock_nested+0x50/0x3fc
[   12.182440] [<ffffffc0007b9424>] iio_kfifo_buf_data_available+0x28/0x4c
[   12.189043] [<ffffffc0007b76ac>] iio_buffer_ready+0x60/0xe0
[   12.194608] [<ffffffc0007b7834>] iio_buffer_read_first_n_outer+0x108/0x1a8
[   12.201474] [<ffffffc000370d48>] __vfs_read+0x58/0x114
[   12.206606] [<ffffffc000371740>] vfs_read+0x94/0x118
[   12.211564] [<ffffffc0003720f8>] SyS_read+0x64/0xb4
[   12.216436] [<ffffffc000203cb4>] 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 <briannorris@chromium.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-07 08:32:41 +02:00
..
accel iio: accel: kxsd9: fix the usage of spi_w8r8() 2016-07-27 09:47:37 -07:00
adc iio:ad7266: Fix probe deferral for vref 2016-07-27 09:47:37 -07:00
amplifiers spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
buffer iio: Move generic buffer implementations to sub-directory 2015-08-16 10:51:21 +01:00
chemical iio: chemical: vz89x hardware i2c workaround 2015-09-30 18:20:53 +01:00
common spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
dac iio: dac: mcp4725: set iio name property in sysfs 2016-02-25 12:01:17 -08:00
frequency spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
gyro iio: gyro: bmg160: fix endianness when reading axes 2016-04-20 15:42:12 +09:00
humidity iio: hudmidity: hdc100x: fix incorrect shifting and scaling 2016-07-27 09:47:36 -07:00
imu iio: adis_buffer: Fix out-of-bounds memory access 2016-02-25 12:01:17 -08:00
light iio: light apds9960: Add the missing dev.parent 2016-07-27 09:47:36 -07:00
magnetometer iio: ak8975: fix maybe-uninitialized warning 2016-05-11 11:21:23 +02:00
orientation
potentiometer iio: mcp4531: Driver for Microchip digital potentiometers 2015-09-30 18:20:53 +01:00
pressure iio:st_pressure: fix sampling gains (bring inline with ABI) 2016-07-27 09:47:36 -07:00
proximity iio: proximity: as3935: fix buffer stack trashing 2016-07-27 09:47:36 -07:00
temperature Add tsys02d meas-spec driver support 2015-10-11 10:21:19 +01:00
trigger
iio_core_trigger.h
iio_core.h
industrialio-buffer.c iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING" 2016-09-07 08:32:41 +02:00
industrialio-core.c iio: fix some warning messages 2015-11-21 16:00:05 +00:00
industrialio-event.c iio: event: Remove negative error code from iio_event_poll 2015-08-12 19:26:39 +01:00
industrialio-trigger.c iio: Fix error handling in iio_trigger_attach_poll_func 2016-07-27 09:47:36 -07:00
industrialio-triggered-event.c iio: Support triggered events 2015-08-27 20:47:09 +01:00
inkern.c iio: inkern: fix a NULL dereference on error 2016-02-25 12:01:17 -08:00
Kconfig iio: mcp4531: Driver for Microchip digital potentiometers 2015-09-30 18:20:53 +01:00
Makefile iio: mcp4531: Driver for Microchip digital potentiometers 2015-09-30 18:20:53 +01:00