drivers: can: transceiver: Place API into iterable section
Add wrapper DEVICE_API macro to all can_transceiver_driver_api instances. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
30b30c29a3
commit
19c9d0894a
2 changed files with 3 additions and 9 deletions
|
|
@ -110,7 +110,7 @@ static int can_transceiver_gpio_init(const struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct can_transceiver_driver_api can_transceiver_gpio_driver_api = {
|
static DEVICE_API(can_transceiver, can_transceiver_gpio_driver_api) = {
|
||||||
.enable = can_transceiver_gpio_enable,
|
.enable = can_transceiver_gpio_enable,
|
||||||
.disable = can_transceiver_gpio_disable,
|
.disable = can_transceiver_gpio_disable,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,7 @@ __subsystem struct can_transceiver_driver_api {
|
||||||
*/
|
*/
|
||||||
static inline int can_transceiver_enable(const struct device *dev, can_mode_t mode)
|
static inline int can_transceiver_enable(const struct device *dev, can_mode_t mode)
|
||||||
{
|
{
|
||||||
const struct can_transceiver_driver_api *api =
|
return DEVICE_API_GET(can_transceiver, dev)->enable(dev, mode);
|
||||||
(const struct can_transceiver_driver_api *)dev->api;
|
|
||||||
|
|
||||||
return api->enable(dev, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,10 +84,7 @@ static inline int can_transceiver_enable(const struct device *dev, can_mode_t mo
|
||||||
*/
|
*/
|
||||||
static inline int can_transceiver_disable(const struct device *dev)
|
static inline int can_transceiver_disable(const struct device *dev)
|
||||||
{
|
{
|
||||||
const struct can_transceiver_driver_api *api =
|
return DEVICE_API_GET(can_transceiver, dev)->disable(dev);
|
||||||
(const struct can_transceiver_driver_api *)dev->api;
|
|
||||||
|
|
||||||
return api->disable(dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue