__phy_set_bits(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __phy_set_bits(9)

okay so bestie, welcome to the kernel API manual page for __phy_set_bits(9) β€” yes the double underscore one, we'll get to why that matters (spoiler: it's a locking thing 🫢). Grab a lil snack, this one's short but important ✨


✨ NAME ✨

__phy_set_bits β€” literally just a convenience function for setting bits in a PHY register πŸŽ€ no cap, that's the whole vibe


🌸 SYNOPSIS 🌸

int __phy_set_bits (struct phy_device *phydev , u32 regnum , u16 val );

it returns an int, it takes three args, it's giving "small function, big responsibilities" energy πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • phydev β€” the phy_device struct πŸ’– this is your PHY device, your main character, the whole reason we're here
  • regnum β€” register number to write ✍️ a u32, and this is which register we're poking
  • val β€” bits to set πŸ”₯ a u16, the actual bits going up to 1

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, and it is important tea: the caller must have taken the MDIO bus lock. πŸ”’

like, that's it, that's the description. but do not skim past it bestie!! that's the whole reason this function has the double underscore prefix β€” you are the one holding the lock, so there's no internal locking happening for you. if you didn't take the lock, you are in the danger zone πŸ’€

🫢 reminder: caller takes the MDIO bus lock. mdio bus lock = taken. by the caller. that's you. periodt.

🧚 SEE ALSO 🧚

the full friend group, no one left out, all of these:

Kernel file ./include/linux/phy.h 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_read_mmd_poll_timeout(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)

like I said. everybody. the whole gc πŸ˜­πŸ’œ


🌈 okay that's the page!! shoutout to ./include/linux for being the source, this one's dated October 2026, and it's __phy_set_bits(9) from the Kernel API Manual β€” slay, iconic, remember to hold that MDIO bus lock bestie πŸ’…βœ¨

πŸ“¦ where this page comes from