phy_device_remove(9)
πΈ phy_device_remove(9) β Kernel API Manual πΈ
okay bestie, welcome to the glow-up era of the kernel API manual π
this one's from the phy_device_remove page and it's short, sweet, and honestly iconic for it. let's get into it π«Ά
β¨ NAME β¨
phy_device_remove β take a phy device that was already registered and yeet it off the MDIO bus π¦
like, not destroy it, just un-register it. big difference. keep reading, i promise it matters π
β¨ SYNOPSIS β¨
void phy_device_remove (struct phy_device *phydev );
no return value, returns nothing, gives you zero information back β it's giving void and honestly? respect π
β¨ ARGUMENTS β¨
phydevβ thephy_devicestructure you're removing. that's it. that's the whole argument. one (1) singular phy device to evict π
β¨ DESCRIPTION β¨
okay so this is the part where you need to listen, because this is the classic gotcha π
This doesn't free the phy_device itself. like, at all. nope. what it actually does is merely reverse the effects of phy_device_register. that's the whole job. it undoes the registration, it does not go anywhere near freeing your memory π₯
so if you're sitting there thinking "cool, removed it, memory's handled" β no bestie. use phy_device_free to free the device after calling this function. after. like, this function first, then that one. in that order. periodt π
lowkey the most important sentence on this whole page: remove β free. do both, in the right order, or the vibe check will fail catastrophically π§
β¨ SEE ALSO β¨
the source lives in the kernel file ./drivers/net/phy/phy_device.c β and the related-manpage section is stacked, like genuinely a whole friend group of functions π
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_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_mdio_find_device(9),fwnode_phy_find_device(9),fwnode_get_phy_node(9),phy_probe(9),phy_driver_register(9)
and that's the page!! short king of a manpage, but every word counts π this one's filed under ./drivers/net/phy, dated October 2026 β so like, future-dated but still exactly as iconic as ever π mwah, go free your phy devices properly πβ¨
π¦ 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