genphy_match_phy_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… genphy_match_phy_device(9) β€” the Kernel API Manual, bestie edition

okay so this is a page from the Kernel API Manual and it's literally about one tiny little function that plays matchmaker πŸ’–βœ¨


🌸 NAME

genphy_match_phy_device β€” match a PHY device with a PHY driver

like, it's the vibe-check function for hardware. does this device fw this driver? let's find out πŸŽ€


✨ SYNOPSIS

int genphy_match_phy_device (struct phy_device *phydev , const struct phy_driver *phydrv );

πŸ¦‹ ARGUMENTS

  • phydev β€” the target phy_device struct. this is the one being matched up, the main character of the operation πŸ‘‘
  • phydrv β€” the target phy_driver struct. this is the potential match, the one doing the swooning πŸ’…

πŸ’œ DESCRIPTION

so what it does is: it checks whether the given PHY device matches the specified PHY driver. that's the whole thing. that's the assignment. 🫢

but how it checks? that's where it gets spicy 🌢️

  • for Clause 45 PHYs, it iterates over the available device identifiers and compares them against the driver's expected PHY ID, applying the provided mask. yes really, it goes through all of them, one by one, no skipping, no shortcuts. dedicated queen behavior fr fr πŸ’€
  • for Clause 22 PHYs, it just does a direct ID comparison. simple. clean. lowkey iconic for it 🌈

⭐ RETURN

1 if the PHY device matches the driver, 0 otherwise.

so basically yes or no, no in-between, no "it's complicated" 😭


πŸ”₯ SEE ALSO

the kernel file ./drivers/net/phy/phy_device.c β€” and then a whole group chat of friends, because this function is never alone:

phy_uses_state_machine(9), phy_register_fixup(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_mdio_find_device(9), fwnode_phy_find_device(9), fwnode_get_phy_node(9), phy_probe(9), phy_driver_register(9)

like yes that's a lot of friends but every single one of them matters, don't skip any πŸ’–


ok that's the whole page! short and sweet, just like this function. no cap 🧚

signing off from ./drivers/net/phy, dated October 2026 β€” stay slay, kernel bestie πŸŽ€πŸ’œ

πŸ“¦ where this page comes from