drivers: sensor: fdc2x1x: Store sensor trigger as a pointer
Fixes the fdc2x1x sensor driver to store the user-supplied sensor trigger as a pointer rather than a copy. This enables the trigger handler to use CONTAINER_OF to retrieve a context pointer when the trigger is embedded in a larger struct. Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
parent
c45595e164
commit
77cb3aeeb5
|
@ -155,7 +155,7 @@ struct fdc2x1x_data {
|
|||
|
||||
struct k_mutex trigger_mutex;
|
||||
sensor_trigger_handler_t drdy_handler;
|
||||
struct sensor_trigger drdy_trigger;
|
||||
const struct sensor_trigger *drdy_trigger;
|
||||
const struct device *dev;
|
||||
|
||||
#ifdef CONFIG_FDC2X1X_TRIGGER_OWN_THREAD
|
||||
|
|
|
@ -41,7 +41,7 @@ static void fdc2x1x_thread_cb(const struct device *dev)
|
|||
|
||||
k_mutex_lock(&drv_data->trigger_mutex, K_FOREVER);
|
||||
if ((drv_data->drdy_handler != NULL) && FDC2X1X_STATUS_DRDY(status)) {
|
||||
drv_data->drdy_handler(dev, &drv_data->drdy_trigger);
|
||||
drv_data->drdy_handler(dev, drv_data->drdy_trigger);
|
||||
}
|
||||
k_mutex_unlock(&drv_data->trigger_mutex);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ int fdc2x1x_trigger_set(const struct device *dev,
|
|||
case SENSOR_TRIG_DATA_READY:
|
||||
k_mutex_lock(&drv_data->trigger_mutex, K_FOREVER);
|
||||
drv_data->drdy_handler = handler;
|
||||
drv_data->drdy_trigger = *trig;
|
||||
drv_data->drdy_trigger = trig;
|
||||
k_mutex_unlock(&drv_data->trigger_mutex);
|
||||
|
||||
int_mask = FDC2X1X_ERROR_CONFIG_DRDY_2INT_MSK;
|
||||
|
|
Loading…
Reference in a new issue