drivers: mdio: use DEVICE_API_GET
use DEVICE_API_GET in mdio.h Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
parent
cf8049a9ed
commit
c55277f058
1 changed files with 12 additions and 30 deletions
|
@ -70,11 +70,8 @@ __syscall void mdio_bus_enable(const struct device *dev);
|
|||
|
||||
static inline void z_impl_mdio_bus_enable(const struct device *dev)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->bus_enable != NULL) {
|
||||
api->bus_enable(dev);
|
||||
if (DEVICE_API_GET(mdio, dev)->bus_enable != NULL) {
|
||||
DEVICE_API_GET(mdio, dev)->bus_enable(dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,11 +85,8 @@ __syscall void mdio_bus_disable(const struct device *dev);
|
|||
|
||||
static inline void z_impl_mdio_bus_disable(const struct device *dev)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->bus_disable != NULL) {
|
||||
api->bus_disable(dev);
|
||||
if (DEVICE_API_GET(mdio, dev)->bus_disable != NULL) {
|
||||
DEVICE_API_GET(mdio, dev)->bus_disable(dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,14 +112,11 @@ __syscall int mdio_read(const struct device *dev, uint8_t prtad, uint8_t regad,
|
|||
static inline int z_impl_mdio_read(const struct device *dev, uint8_t prtad,
|
||||
uint8_t regad, uint16_t *data)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->read == NULL) {
|
||||
if (DEVICE_API_GET(mdio, dev)->read == NULL) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->read(dev, prtad, regad, data);
|
||||
return DEVICE_API_GET(mdio, dev)->read(dev, prtad, regad, data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,14 +142,11 @@ __syscall int mdio_write(const struct device *dev, uint8_t prtad, uint8_t regad,
|
|||
static inline int z_impl_mdio_write(const struct device *dev, uint8_t prtad,
|
||||
uint8_t regad, uint16_t data)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->write == NULL) {
|
||||
if (DEVICE_API_GET(mdio, dev)->write == NULL) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->write(dev, prtad, regad, data);
|
||||
return DEVICE_API_GET(mdio, dev)->write(dev, prtad, regad, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,14 +173,11 @@ static inline int z_impl_mdio_read_c45(const struct device *dev, uint8_t prtad,
|
|||
uint8_t devad, uint16_t regad,
|
||||
uint16_t *data)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->read_c45 == NULL) {
|
||||
if (DEVICE_API_GET(mdio, dev)->read_c45 == NULL) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->read_c45(dev, prtad, devad, regad, data);
|
||||
return DEVICE_API_GET(mdio, dev)->read_c45(dev, prtad, devad, regad, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,14 +204,11 @@ static inline int z_impl_mdio_write_c45(const struct device *dev, uint8_t prtad,
|
|||
uint8_t devad, uint16_t regad,
|
||||
uint16_t data)
|
||||
{
|
||||
const struct mdio_driver_api *api =
|
||||
(const struct mdio_driver_api *)dev->api;
|
||||
|
||||
if (api->write_c45 == NULL) {
|
||||
if (DEVICE_API_GET(mdio, dev)->write_c45 == NULL) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
return api->write_c45(dev, prtad, devad, regad, data);
|
||||
return DEVICE_API_GET(mdio, dev)->write_c45(dev, prtad, devad, regad, data);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue