fwnode_mdio_find_device(9)
π NAME π
okay so this is fwnode_mdio_find_device β it's in the Kernel API Manual, and what it does is: you hand it a fwnode, and it finds you the mdio_device. that's literally it, that's the whole vibe π
β¨ SYNOPSIS β¨
struct mdio_device * fwnode_mdio_find_device (struct fwnode_handle
*fwnode );
like, yes, it wraps across two lines. that's just how the manpage formatting ate it. she's still iconic π«Ά
π ARGUMENTS π
fwnodeβ pointer to themdio_device'sfwnode. that's the thing you're searching by, bestie β¨
π¦ DESCRIPTION π¦
so here's the tea, and you need to actually listen to this part:
if it goes well, it returns a pointer to the mdio_device β and listen π the embedded struct device refcount gets incremented by one. so you are now holding a reference, and it is yours to deal with. it can also return NULL on failure, which is the sad path, no cap π
π¨ and because the refcount got bumped, the caller should callput_deviceon themdio_deviceafter its use. this is not optional garnish, this is the whole deal. you found it, you increment it, you release it. periodt π
π SEE ALSO π
the kernel file is ./drivers/net/phy/phy_device.c and honestly it has SO many friends, look at this lineup π₯
phy_uses_state_machine(9),phy_register_fixup(9),genphy_match_phy_device(9),get_phy_c45_ids(9),get_phy_c22_id(9)get_phy_device(9),phy_device_register(9),phy_device_remove(9),phy_get_c45_ids(9),phy_find_next(9)phy_prepare_link(9),phy_connect_direct(9),phy_connect(9),phy_disconnect(9),phy_poll_reset(9)phy_sfp_connect_phy(9),phy_sfp_disconnect_phy(9),phy_sfp_attach(9),phy_sfp_detach(9),phy_sfp_probe(9)phy_attach_direct(9),phy_detach(9),phy_reset_after_clk_enable(9),genphy_config_advert(9),genphy_c37_config_advert(9)genphy_setup_forced(9),genphy_restart_aneg(9),genphy_check_and_restart_aneg(9),__genphy_config_aneg(9),genphy_c37_config_aneg(9)genphy_aneg_done(9),genphy_update_link(9),genphy_read_status_fixed(9),genphy_read_status(9),genphy_c37_read_status(9)genphy_soft_reset(9),genphy_read_abilities(9),phy_remove_link_mode(9),phy_advertise_supported(9),phy_advertise_eee_all(9)phy_support_eee(9),phy_disable_eee(9),phy_support_sym_pause(9),phy_support_asym_pause(9),phy_set_sym_pause(9)phy_set_asym_pause(9),phy_validate_pause(9),phy_get_pause(9),phy_get_internal_delay(9),phy_get_tx_amplitude_gain(9)phy_get_mac_termination(9),phy_get_sfp_port(9),fwnode_phy_find_device(9),fwnode_get_phy_node(9),phy_probe(9)phy_driver_register(9)
likeβ¦ the friend group is huge and every single one of them is a (9). iykyk πΈ
and that's the page, bestie π this one lives in ./drivers/net/phy, it's the October 2026 version, and it's filed under fwnode_mdio_find_device(9). go forth, find your device, and please remember the put_device. mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms