From 7201af700aa96f238144951a2ebff4c82d7a3a75 Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Fri, 12 Jun 2020 09:21:50 -0500 Subject: [PATCH 1/3] drivers: gpio_intel_apl: remove inappropriate assignment of API pointer This is set when the device is defined, and should not be modified. Signed-off-by: Peter Bigot --- drivers/gpio/gpio_intel_apl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpio/gpio_intel_apl.c b/drivers/gpio/gpio_intel_apl.c index b60f4fce6763..e34776eabef9 100644 --- a/drivers/gpio/gpio_intel_apl.c +++ b/drivers/gpio/gpio_intel_apl.c @@ -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; } From ac90d6b710d13231b3aa2feb6542f02c20afdfe6 Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Fri, 12 Jun 2020 09:23:02 -0500 Subject: [PATCH 2/3] drivers: i2c_dw: remove inappropriate assignment of API pointer This is set when the device is defined, and should not be modified. Signed-off-by: Peter Bigot --- drivers/i2c/i2c_dw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/i2c/i2c_dw.c b/drivers/i2c/i2c_dw.c index 17e20361861b..0a0e8eaf556a 100644 --- a/drivers/i2c/i2c_dw.c +++ b/drivers/i2c/i2c_dw.c @@ -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; From 1ff6dc3023c2256eb465f30235aef42821c7ba0a Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Fri, 12 Jun 2020 10:13:21 -0500 Subject: [PATCH 3/3] docs: drivers: remove suggestion to assign driver_api in init function The driver API should be assigned at the time the device is defined. Assigning in the init function is redundant and prevents moving the pointer to a immutable driver structure. Signed-off-by: Peter Bigot --- doc/reference/drivers/index.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/reference/drivers/index.rst b/doc/reference/drivers/index.rst index 017e955582ae..7a25f2cfda74 100644 --- a/doc/reference/drivers/index.rst +++ b/doc/reference/drivers/index.rst @@ -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::