Skip to content

device: avoid direct assignment to device api pointer #26190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions doc/reference/drivers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ of these APIs, and populate an instance of subsystem_api structure:
};

The driver would then pass ``my_driver_api_funcs`` as the ``api`` argument to
``DEVICE_AND_API_INIT()``, or manually assign it to ``device->driver_api``
in the driver init function.
``DEVICE_AND_API_INIT()``.

.. note::

Expand Down
2 changes: 0 additions & 2 deletions drivers/gpio/gpio_intel_apl.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,6 @@ int gpio_intel_apl_init(struct device *dev)
sys_bitfield_clear_bit(cfg->reg_base + REG_MISCCFG,
MISCCFG_IRQ_ROUTE_POS);

dev->driver_api = &gpio_intel_apl_api;

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/i2c/i2c_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ static int i2c_dw_initialize(struct device *dev)

/* verify that we have a valid DesignWare register first */
if (regs->ic_comp_type != I2C_DW_MAGIC_KEY) {
dev->driver_api = NULL;
LOG_DBG("I2C: DesignWare magic key not found, check base "
"address. Stopping initialization");
return -EIO;
Expand Down