kernel-ark/drivers/iio
Lars-Peter Clausen 0d5b7dae89 iio: Prevent race between IIO chardev opening and IIO device free
Set the IIO device as the parent for the character device

We need to make sure that the IIO device is not freed while the character device
exists, otherwise the freeing of the IIO device might race against the file open
callback. Do this by setting the character device's parent to the IIO device,
this will cause the character device to grab a reference to the IIO device and
only release it once the character device itself has been removed.

Also move the registration of the character device before the registration of
the IIO device to avoid the (rather theoretical case) that the IIO device is
already freed again before we can add the character device and grab a reference
to the IIO device.

We also need to move the call to cdev_del() from iio_dev_release() to
iio_device_unregister() (where it should have been in the first place anyway) to
avoid a reference cycle. As iio_dev_release() is only called once all reference
are dropped, but the character device holds a reference to the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 12:50:23 +01:00
..
accel iio: Fix bma180 dev-to-indio_dev conversion in suspend/resume 2013-09-21 12:04:34 +01:00
adc iio: at91: fix adc_clk overflow 2013-09-18 19:43:20 +01:00
amplifiers iio: amplifiers: ad8366: Use devm_* APIs 2013-08-03 21:00:15 +01:00
common iio: Add a comment to about alphabetical order to Kconfigs and Makefiles 2013-08-03 18:40:36 +01:00
dac iio: Fix mcp4725 dev-to-indio_dev conversion in suspend/resume 2013-09-21 12:04:48 +01:00
frequency iio: frequency: ad9523: Use devm_* APIs 2013-08-03 21:01:27 +01:00
gyro iio: Remove unnecessary _write_raw_get_fmt() in several hid-sensor drivers 2013-08-19 20:01:25 +01:00
imu iio: imu: inv_mpu6050: Use devm_iio_device_alloc 2013-08-03 18:55:24 +01:00
light staging tree merge for 3.12-rc1 2013-09-03 11:37:57 -07:00
magnetometer iio: Remove unnecessary _write_raw_get_fmt() in several hid-sensor drivers 2013-08-19 20:01:25 +01:00
pressure iio: pressure: st_pressure: Use devm_iio_device_alloc 2013-08-03 21:02:38 +01:00
temperature iio: Fix tmp006 dev-to-indio_dev conversion in suspend/resume 2013-09-21 12:03:02 +01:00
trigger iio: Add a comment to about alphabetical order to Kconfigs and Makefiles 2013-08-03 18:40:36 +01:00
buffer_cb.c iio:callback buffer: free the scan_mask 2013-06-04 18:19:30 +01:00
iio_core_trigger.h iio: fix semicolon in io_core_trigger.h 2013-08-03 18:40:32 +01:00
iio_core.h iio: Stop sampling when the device is removed 2013-09-21 12:36:30 +01:00
industrialio-buffer.c iio: Stop sampling when the device is removed 2013-09-21 12:36:30 +01:00
industrialio-core.c iio: Prevent race between IIO chardev opening and IIO device free 2013-09-21 12:50:23 +01:00
industrialio-event.c iio: fix: Keep a reference to the IIO device for open file descriptors 2013-09-21 12:45:07 +01:00
industrialio-trigger.c iio: trigger: implement devm_iio_trigger_alloc/devm_iio_triger_free 2013-08-17 19:34:52 +01:00
industrialio-triggered-buffer.c
inkern.c iio: inkern: fix iio_convert_raw_to_processed_unlocked 2013-07-03 20:30:52 +01:00
Kconfig Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
kfifo_buf.c staging:iio: Remove noop call to __iio_update_buffer 2013-01-31 17:56:44 +00:00
Makefile iio: Restore alphabetic order in Makefile 2013-08-17 15:50:54 +01:00