Commit 1095cb4
drivers: sensor: migrate simulated sensors to DEVICE_API
Upstream Zephyr moved device API structs into per-class iterable linker
sections and made the sensor accessors resolve the API through
DEVICE_API_GET(sensor, dev). With CONFIG_DEVICE_API_ASSERT enabled
(default when CONFIG_ASSERT=y) this asserts that dev->api points inside
the _sensor_driver_api section, otherwise it fails at runtime with
"device API is not sensor".
The Nordic sensor_sim and sensor_stub drivers still declared their API
as a plain "static const struct sensor_driver_api", so the struct was
not placed in that section and the assert fired the first time the CAF
sensor manager called sensor_sample_fetch(). This broke the
caf_sensor_manager.core test (sensor_sim) and the caf_sensor_manager
sample (sensor_stub) on qemu_cortex_m3 after the upmerge.
Declared both driver APIs with DEVICE_API(sensor, ...), matching the
idiom used by all upstream sensor drivers, so the API lands in the
_sensor_driver_api iterable section and passes the runtime check.
Ref: NCSDK-40421
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>1 parent 522130a commit 1095cb4
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
| 522 | + | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
0 commit comments