Skip to content

Commit 3ef9880

Browse files
decsnyfabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent 5033399 commit 3ef9880

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/zephyr/drivers/mdio.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ static inline void z_impl_mdio_bus_enable(const struct device *dev)
7373
const struct mdio_driver_api *api =
7474
(const struct mdio_driver_api *)dev->api;
7575

76-
api->bus_enable(dev);
76+
if (api->bus_enable != NULL) {
77+
api->bus_enable(dev);
78+
}
7779
}
7880

7981
/**
@@ -89,7 +91,9 @@ static inline void z_impl_mdio_bus_disable(const struct device *dev)
8991
const struct mdio_driver_api *api =
9092
(const struct mdio_driver_api *)dev->api;
9193

92-
api->bus_disable(dev);
94+
if (api->bus_disable != NULL) {
95+
api->bus_disable(dev);
96+
}
9397
}
9498

9599
/**

0 commit comments

Comments
 (0)