drivers: sensor: hts221: Store sensor trigger as a pointer
Fixes the hts221 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
73ddc98ea0
commit
466c5501bc
|
@ -43,7 +43,7 @@ struct hts221_data {
|
|||
const struct device *dev;
|
||||
struct gpio_callback drdy_cb;
|
||||
|
||||
struct sensor_trigger data_ready_trigger;
|
||||
const struct sensor_trigger *data_ready_trigger;
|
||||
sensor_trigger_handler_t data_ready_handler;
|
||||
|
||||
#if defined(CONFIG_HTS221_TRIGGER_OWN_THREAD)
|
||||
|
|
|
@ -45,7 +45,7 @@ static void process_drdy(const struct device *dev)
|
|||
struct hts221_data *data = dev->data;
|
||||
|
||||
if (data->data_ready_handler != NULL) {
|
||||
data->data_ready_handler(dev, &data->data_ready_trigger);
|
||||
data->data_ready_handler(dev, data->data_ready_trigger);
|
||||
}
|
||||
|
||||
if (data->data_ready_handler != NULL) {
|
||||
|
@ -69,7 +69,7 @@ int hts221_trigger_set(const struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
data->data_ready_trigger = *trig;
|
||||
data->data_ready_trigger = trig;
|
||||
|
||||
setup_drdy(dev, true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue