sensors : fix bad pin value when disabling interruption

In sensors drivers, in gpio callback function :
The device structure in parameter is related to the gpio device.

Signed-off-by: laurence pasteau <laurence.pasteau@stimio.fr>
This commit is contained in:
laurence pasteau 2020-06-22 17:56:32 +02:00 committed by Maureen Helm
commit ba3a6dce95
18 changed files with 28 additions and 27 deletions

View file

@ -176,6 +176,7 @@ struct lsm6dso_data {
sensor_trigger_handler_t handler_drdy_acc;
sensor_trigger_handler_t handler_drdy_gyr;
sensor_trigger_handler_t handler_drdy_temp;
struct device *dev;
#if defined(CONFIG_LSM6DSO_TRIGGER_OWN_THREAD)
K_THREAD_STACK_MEMBER(thread_stack, CONFIG_LSM6DSO_THREAD_STACK_SIZE);
@ -183,7 +184,6 @@ struct lsm6dso_data {
struct k_sem gpio_sem;
#elif defined(CONFIG_LSM6DSO_TRIGGER_GLOBAL_THREAD)
struct k_work work;
struct device *dev;
#endif
#endif /* CONFIG_LSM6DSO_TRIGGER */

View file

@ -209,7 +209,7 @@ static void lsm6dso_gpio_callback(struct device *dev,
{
struct lsm6dso_data *lsm6dso =
CONTAINER_OF(cb, struct lsm6dso_data, gpio_cb);
const struct lsm6dso_config *cfg = dev->config_info;
const struct lsm6dso_config *cfg = lsm6dso->dev->config_info;
ARG_UNUSED(pins);
@ -261,6 +261,7 @@ int lsm6dso_init_interrupt(struct device *dev)
cfg->int_gpio_port);
return -EINVAL;
}
lsm6dso->dev = dev;
#if defined(CONFIG_LSM6DSO_TRIGGER_OWN_THREAD)
k_sem_init(&lsm6dso->gpio_sem, 0, UINT_MAX);
@ -272,7 +273,6 @@ int lsm6dso_init_interrupt(struct device *dev)
0, K_NO_WAIT);
#elif defined(CONFIG_LSM6DSO_TRIGGER_GLOBAL_THREAD)
lsm6dso->work.handler = lsm6dso_work_cb;
lsm6dso->dev = dev;
#endif /* CONFIG_LSM6DSO_TRIGGER_OWN_THREAD */
ret = gpio_pin_configure(lsm6dso->gpio, cfg->int_gpio_pin,