phy_read_mmd_poll_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… phy_read_mmd_poll_timeout πŸ’…

okay so this is a page from the Kernel API Manual, and bestie, it's literally about poking a PHY register over and over until it gives you what you want β€” or until time runs out and everyone goes home. no cap.

✨ NAME ✨

phy_read_mmd_poll_timeout β€” periodically poll a PHY register until a condition is met or a timeout occurs πŸŽ€

like. it keeps knocking on the door (the register) until somebody answers (the condition) or the clock runs out (the timeout). iconic behaviour honestly.


🌸 SYNOPSIS 🌸

phy_read_mmd_poll_timeout (phydev , devaddr , regnum , val , cond ,
sleep_us , timeout_us , sleep_before_read );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • phydev β€” the phy_device struct, your main character ✨
  • devaddr β€” the MMD you're reading from, iykyk
  • regnum β€” the register on the MMD you wanna read
  • val β€” the variable the register value gets read into 🫢
  • cond β€” the break condition (usually it's out here involving val, fr fr)
  • sleep_us β€” max time to sleep between reads, in us (0 means tight-loops πŸ”₯). and listen β€” please go read the usleep_range function description for the details and the limitations, bestie, it matters
  • sleep_before_read β€” if it's true, sleep sleep_us before the read. giving very much "look before you leap" energy πŸ™ˆ
  • timeout_us β€” timeout in us; 0 means it never times out πŸ‘‘

πŸ’œ RETURN πŸ’œ

0 on success, and -ETIMEDOUT upon a timeout 😭. either way, the last value that got read is stored in val β€” so you always get the receipts, no matter how it ends.

⚠️ big warning energy: this must not be called from atomic context if sleep_us or timeout_us are used. do not do it. not the vibe. πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./include/linux/phy.h β€” and honestly, the whole friend group showed up:

enum phy_interface_t(9), phy_modes(9), rgmii_clock(9), struct mdio_bus_stats(9), struct mii_bus(9), mdiobus_alloc(9), enum phy_state(9), struct phy_c45_device_ids(9), struct phy_oatc14_sqi_capability(9), struct phy_device(9), struct phy_tdr_config(9), enum link_inband_signalling(9), struct phy_plca_cfg(9), struct phy_plca_status(9), struct phy_led(9), struct phy_mse_capability(9), struct phy_mse_snapshot(9), struct phy_driver(9), phy_id_compare(9), phy_id_compare_vendor(9), phy_id_compare_model(9), phydev_id_compare(9), phy_is_started(9), phy_driver_is_genphy(9), phy_disable_eee_mode(9), phy_can_wakeup(9), phy_may_wakeup(9), phy_read(9), __phy_read(9), phy_write(9), __phy_write(9), __phy_modify_changed(9), __phy_set_bits(9), __phy_clear_bits(9), phy_set_bits(9), phy_clear_bits(9), __phy_set_bits_mmd(9), __phy_clear_bits_mmd(9), phy_set_bits_mmd(9), phy_clear_bits_mmd(9), phy_interrupt_is_valid(9), phy_polling_mode(9), phy_has_hwtstamp(9), phy_has_rxtstamp(9), phy_has_tsinfo(9), phy_has_txtstamp(9), phy_is_default_hwtstamp(9), phy_on_sfp(9), phy_interface_mode_is_rgmii(9), phy_interface_mode_is_8023z(9), phy_interface_is_rgmii(9), phy_is_pseudo_fixed_link(9), phy_module_driver(9)


and that's the whole page, bestie πŸ§šπŸ’– this one lives in ./include/linux, dated October 2026, and it was phy_read_mmd_poll_timeout(9) the whole time ✨ slay, go poll that register, periodt πŸ’…

πŸ“¦ where this page comes from