include: mdio.h: Make bus functions optional

Make bus_enable and bus_disable optional for drivers
to implement by checking if it is NULL in the api struct.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
Declan Snyder 2024-04-22 11:03:42 -05:00 committed by Fabio Baltieri
parent 5033399322
commit 3ef9880457

View file

@ -73,7 +73,9 @@ 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;
api->bus_enable(dev);
if (api->bus_enable != NULL) {
api->bus_enable(dev);
}
}
/**
@ -89,7 +91,9 @@ 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;
api->bus_disable(dev);
if (api->bus_disable != NULL) {
api->bus_disable(dev);
}
}
/**