Skip to content

Commit 44f9f9f

Browse files
maass-hamburgkartben
authored andcommitted
drivers: ethernet: phy: clarify phy_link_callback_set()
clarify phy_link_callback_set() duties. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 3237fd2 commit 44f9f9f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/zephyr/net/phy.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ __subsystem struct ethphy_driver_api {
167167
/** Configure link */
168168
int (*cfg_link)(const struct device *dev, enum phy_link_speed adv_speeds);
169169

170-
/** Set callback to be invoked when link state changes. */
170+
/** Set callback to be invoked when link state changes. Driver has to invoke
171+
* callback once after setting it, even if link state has not changed.
172+
*/
171173
int (*link_cb_set)(const struct device *dev, phy_callback_t cb, void *user_data);
172174

173175
/** Read PHY register */
@@ -247,7 +249,11 @@ static inline int phy_get_link_state(const struct device *dev, struct phy_link_s
247249
*
248250
* Sets a callback that is invoked when link state changes. This is the
249251
* preferred method for ethernet drivers to be notified of the PHY link
250-
* state change.
252+
* state change. The callback will be invoked once after setting it,
253+
* even if link state has not changed. There can only one callback
254+
* function set and active at a time. This function is mainly used
255+
* by ethernet drivers to register a callback to be notified of
256+
* link state changes and should therefore not be used by applications.
251257
*
252258
* @param[in] dev PHY device structure
253259
* @param callback Callback handler

0 commit comments

Comments
 (0)