iio: cros: Register FIFO callback after sensor is registered
authorGwendal Grignou <gwendal@chromium.org>
Mon, 11 Jul 2022 14:47:16 +0000 (07:47 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 18 Jul 2022 17:29:13 +0000 (18:29 +0100)
commit0b4ae3f6d1210c11f9baf159009c7227eacf90f2
tree64865906b0568150bf4c48b7a9d1806bc0195967
parent0565d238b9b4abb7b904248d9064bea80ac706fe
iio: cros: Register FIFO callback after sensor is registered

Instead of registering callback to process sensor events right at
initialization time, wait for the sensor to be register in the iio
subsystem.

Events can come at probe time (in case the kernel rebooted abruptly
without switching the sensor off for  instance), and be sent to IIO core
before the sensor is fully registered.

Fixes: aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO")
Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20220711144716.642617-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/cros_ec_accel_legacy.c
drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
drivers/iio/light/cros_ec_light_prox.c
drivers/iio/pressure/cros_ec_baro.c
include/linux/iio/common/cros_ec_sensors_core.h