vrahane closed pull request #1023: Sensor API: Support only one event per notifier/notification URL: https://github.com/apache/mynewt-core/pull/1023
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/hw/sensor/src/sensor.c b/hw/sensor/src/sensor.c index 13ac10b91..5ed314ef1 100644 --- a/hw/sensor/src/sensor.c +++ b/hw/sensor/src/sensor.c @@ -982,19 +982,13 @@ sensor_unregister_listener(struct sensor *sensor, } static int -sensor_set_notification(struct sensor *sensor) +sensor_set_notification(struct sensor *sensor, struct sensor_notifier *notifier) { - sensor_event_type_t event_type; - const struct sensor_notifier *notifier; int rc; - event_type = 0; - SLIST_FOREACH(notifier, &sensor->s_notifier_list, sn_next) { - event_type |= notifier->sn_sensor_event_type; - } - if (sensor->s_funcs->sd_set_notification) { - rc = sensor->s_funcs->sd_set_notification(sensor, event_type); + rc = sensor->s_funcs->sd_set_notification(sensor, + notifier->sn_sensor_event_type); } else { rc = SYS_ENODEV; } @@ -1033,7 +1027,7 @@ sensor_register_notifier(struct sensor *sensor, SLIST_INSERT_HEAD(&sensor->s_notifier_list, notifier, sn_next); - rc = sensor_set_notification(sensor); + rc = sensor_set_notification(sensor, notifier); if (rc != 0) { goto remove; } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services