get_phy_device(9)
π get_phy_device(9) β Kernel API Manual π
okay so bestie, welcome to the glow-up of get_phy_device from the Kernel API Manual β she reads the PHY device you point at and hands you back her @phy_device struct. genuinely iconic behaviour. let's get into it π«Ά
β¨ SYNOPSIS β¨
struct phy_device * get_phy_device (struct mii_bus *bus , int addr ,
bool is_c45 );
π ARGUMENTS π
busβ the target MII bus. like, the bus she's gonna go snoop on β¨addrβ PHY address on the MII bus. that's where on the bus, bestie πis_c45β if this is true, the PHY uses the 802.3 clause 45 protocol.true= clause 45 energy,false= not that π
πΈ DESCRIPTION πΈ
So the whole vibe is: probe for a PHY at addr on bus. that's the assignment, and she ate.
When you're probing for a clause 22 PHY, she reads the ID registers. if we find a valid ID, she allocates and returns a struct phy_device. periodt π
When you're probing for a clause 45 PHY, she reads the "devices in package" registers. if the "devices in package" appears valid, she reads the ID registers for each MMD, then allocates and returns a struct phy_device. multiple MMDs, one struct, no notes π¦
And what does she give back? listen closely bestie:
- an allocated
struct phy_deviceon success π -ENODEVif there is no PHY present π-EIOon bus access error π
ngl, those two error codes matter β-ENODEVmeans "nobody home",-EIOmeans "the bus itself fumbled". don't mix them up fr fr.
π SEE ALSO π
Kernel file ./drivers/net/phy/phy_device.c, plus this whole friend group of (9) pages β every single one, no skipping π§:
phy_uses_state_machine(9)phy_register_fixup(9)genphy_match_phy_device(9)get_phy_c45_ids(9)get_phy_c22_id(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_mdio_find_device(9)fwnode_phy_find_device(9)fwnode_get_phy_node(9)phy_probe(9)phy_driver_register(9)
that's the whole page, bestie β go probe something valid π
source/version:./drivers/net/phyΒ· dated October 2026 Β· and yeah, the title up top isget_phy_device(9), slay π
π¦ 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