Skip to content

[BUG] Declaring device driver API instances have to use the DEVICE_API macro #469

@rexut

Description

@rexut

Describe the bug

Related to the Zephyr upstream migration guide for upcoming v4.5: "… The DEVICE_API macro is now mandatory for declaring device driver API instances of any upstream driver class, including in out-of-tree drivers. DEVICE_API_GET now asserts that the API belongs to the requested class, which requires the instance to live in the class’s iterable section. …"

To Reproduce
Steps to reproduce the behavior:

  1. create proper west workspace from latest Bridle main branch
  2. west twister --verbose --inline-logs --integration --testsuite-root bridle/tests/drivers/gpio --tag sc18is604
  3. west twister --verbose --inline-logs --integration --testsuite-root bridle/tests/drivers/i2c --tag sc18is604
  4. See error

Expected behavior

Bridle QA Acceptance Test running w/o errors as before.

Impact

This is a showstopper as long as Bridle violates the Zephyr upstream rules.

Logs and console output

… … …
INFO   - 1/2 native_sim/native/64   drivers.gpio.sc18is604   FAILED rc=1 (native 0.005s <host/gnu>)
… … …
Running TESTSUITE sc18is604_gpio_emul
===================================================================
START - test_pin_get
ASSERTION FAIL [({ extern struct gpio_driver_api _gpio_driver_api_list_start[]; extern const uint8_t _gpio_driver_api_ext_end[]; ((const uint8_t *)((const struct gpio_driver_api *)port->api) < _gpio_driver_api_ext_end && (const uint8_t *)((const struct gpio_driver_api *)port->api) >= (const uint8_t *)_gpio_driver_api_list_start); })] @ WEST_TOPDIR/zephyr/include/zephyr/drivers/gpio.h:1002
	device API is not gpio
@ WEST_TOPDIR/zephyr/lib/os/assert.c:43
… … …
… … …
INFO   - 1/2 native_sim/native/64   drivers.i2c.sc18is604   FAILED rc=1 (native 0.005s <host/gnu>)
… … …
Running TESTSUITE sc18is604_i2c_emul
===================================================================
START - test_read
ASSERTION FAIL [({ extern struct i2c_driver_api _i2c_driver_api_list_start[]; extern const uint8_t _i2c_driver_api_ext_end[]; ((const uint8_t *)((const struct i2c_driver_api *)dev->api) < _i2c_driver_api_ext_end && (const uint8_t *)((const struct i2c_driver_api *)dev->api) >= (const uint8_t *)_i2c_driver_api_list_start); })] @ WEST_TOPDIR/zephyr/include/zephyr/drivers/i2c.h:912
	device API is not i2c
@ WEST_TOPDIR/zephyr/lib/os/assert.c:43
… … …

Screenshots
Non.

Development Environment (please complete the following information):

  • OS: Linux (Ubuntu 20.04.6 LTS)
  • Toolchain: Zephyr SDK 1.0.1
  • Bridle main, Commit SHA 6fa141e

Additional context
Non. — @Irockasingranite FYIO

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions