linux-stable/drivers/iio
Hans de Goede f407e2dca0 iio: accel: bmc150: Don't make the remove function of the second accelerometer unregister itself
On machines with dual accelerometers described in a single ACPI fwnode,
the bmc150_accel_probe() instantiates a second i2c-client for the second
accelerometer.

A pointer to this manually instantiated second i2c-client is stored
inside the iio_dev's private-data through bmc150_set_second_device(),
so that the i2c-client can be unregistered from bmc150_accel_remove().

Before this commit bmc150_set_second_device() took only 1 argument so it
would store the pointer in private-data of the iio_dev belonging to the
manually instantiated i2c-client, leading to the bmc150_accel_remove()
call for the second_dev trying to unregister *itself* while it was
being removed, leading to a deadlock and rmmod hanging.

Change bmc150_set_second_device() to take 2 arguments: 1. The i2c-client
which is instantiating the second i2c-client for the 2nd accelerometer and
2. The second-device pointer itself (which also is an i2c-client).

This will store the second_device pointer in the private data of the
iio_dev belonging to the (ACPI instantiated) i2c-client for the first
accelerometer and will make bmc150_accel_remove() unregister the
second_device i2c-client when called for the first client,
avoiding the deadlock.

Fixes: 5bfb3a4bd8 ("iio: accel: bmc150: Check for a second ACPI device for BOSC0200")
Cc: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-09 20:47:37 +01:00
..
accel iio: accel: bmc150: Don't make the remove function of the second accelerometer unregister itself 2021-06-09 20:47:37 +01:00
adc 1st set of new IIO/counter device support, features and cleanup for 5.14 2021-06-09 12:11:49 +02:00
afe iio: afe: iio-rescale: Support processed channels 2021-06-03 18:24:13 +01:00
amplifiers
buffer iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
cdc iio:cdc:ad7150: Fix use of uninitialized ret 2021-04-07 08:36:39 +01:00
chemical iio: chemical: sgp30: Drop use of %hx in format string. 2021-06-03 18:24:13 +01:00
common iio: hid: trigger: Balance runtime pm + use pm_runtime_resume_and_get() 2021-06-03 18:24:12 +01:00
dac 1st set of new IIO/counter device support, features and cleanup for 5.14 2021-06-09 12:11:49 +02:00
dummy iio: dummy: iio_simple_dummy_buffer: use triggered buffer core calls 2021-03-11 20:47:05 +00:00
frequency
gyro 1st set of new IIO/counter device support, features and cleanup for 5.14 2021-06-09 12:11:49 +02:00
health iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
humidity iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp() 2021-05-17 13:54:29 +01:00
imu iio: imu: inv_mpu6050: Drop use of %hhx format string. 2021-06-09 18:31:03 +01:00
light iio: light: si1145: Drop use of %hhx format specifier. 2021-06-09 18:31:03 +01:00
magnetometer iio: magnetometer: st_magn: Support mount matrix 2021-06-03 18:24:13 +01:00
multiplexer
orientation iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER 2021-05-10 14:01:48 +01:00
position iio: position: hid-sensor-custom-intel-hinge: Drop duplicate parent setting. 2021-05-17 13:49:12 +01:00
potentiometer iio: use getter/setter functions 2021-03-11 20:47:07 +00:00
potentiostat iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() 2021-05-17 13:54:30 +01:00
pressure iio: st_sensors: Make accel, gyro, magn and pressure probe shared 2021-05-17 13:54:22 +01:00
proximity iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp() 2021-05-17 13:54:29 +01:00
resolver
temperature iio: temp: mlx90614: Handle failure in pm_runtime_resume_and_get() 2021-05-17 13:54:26 +01:00
test
trigger iio: trigger: stm32-timer: Convert sysfs sprintf/snprintf family to sysfs_emit 2021-05-17 13:49:05 +01:00
iio_core.h iio: buffer: fix use-after-free for attached_buffers array 2021-03-25 19:13:51 +00:00
iio_core_trigger.h iio: core-trigger: make iio_device_register_trigger_consumer() an int return 2021-03-11 20:47:02 +00:00
industrialio-buffer.c iio: buffer: Remove redundant assignment to in_loc 2021-06-03 18:24:12 +01:00
industrialio-configfs.c
industrialio-core.c iio: Drop Duplicated "mount-matrix" parameter 2021-06-03 18:24:13 +01:00
industrialio-event.c iio:event: Add timeout event info type 2021-04-07 08:36:36 +01:00
industrialio-sw-device.c
industrialio-sw-trigger.c
industrialio-trigger.c iio: core: move @trig_readonly from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
industrialio-triggered-event.c iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
inkern.c iio: core: move @info_exist_lock to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
Kconfig iio:cdc:ad7150: Move driver out of staging. 2021-04-07 08:36:37 +01:00
Makefile iio:cdc:ad7150: Move driver out of staging. 2021-04-07 08:36:37 +01:00
TODO