STRUCT PHY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct phy(9) β€” the kernel API manual, bestie edition πŸ’…

okay so real talk, this is the struct phy(9) page out of the Kernel API Manual, and it's literally the blueprint for how a phy device gets represented in the kernel. no cap, it's foundational. let's get into it 🫢


✨ NAME ✨

struct phy β€” represents the phy device πŸ‘‘

like, it is the phy device. the whole vibe. main character energy fr.


πŸŽ€ SYNOPSIS πŸŽ€

here's the icon itself, character for character, don't touch a thing:

struct phy {
    struct device           dev;
    int id;
    const struct phy_ops    *ops;
    struct mutex            mutex;
    struct lock_class_key   lockdep_key;
    int init_count;
    int power_count;
    struct phy_attrs        attrs;
    struct regulator        *pwr;
    struct dentry           *debugfs;
 };

look at her. gorgeous. every single field matters, so let's go through them one by one πŸ’–


πŸ¦‹ MEMBERS πŸ¦‹

  • dev β€” the phy device itself. that's the device hanging out in there πŸŽ€
  • id β€” the id of the phy device. her little number ✨
  • ops β€” function pointers for performing phy operations. this is where the actual behaviour lives, iykyk πŸ”₯
  • mutex β€” a mutex to protect phy_ops. do not skip the locking, bestie, that's the whole point πŸ’…
  • lockdep_key β€” lockdep information for this mutex. yes she has her own lockdep key, she's that girl πŸŽ€
  • init_count β€” used to protect when the PHY is used by multiple consumers. shared custody situation fr fr πŸ™ˆ
  • power_count β€” used to protect when the PHY is used by multiple consumers. same deal, also for the multiple-consumers protection ✨
  • attrs β€” used to specify PHY specific attributes. the phy-specific details go here 🌸
  • pwr β€” the power regulator associated with the phy. her power supply, iconic ⭐
  • debugfs β€” the debugfs directory. where the debug files live πŸ¦‹
lowkey a reminder: init_count and power_count are both about protecting things when the PHY gets used by multiple consumers. that's not me being repetitive, that's literally what the page says, so I'm keeping both πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

go read these next, bestie, they're all linked from the kernel file ./include/linux/phy/phy.h:

  • union phy_configure_opts(9)
  • struct phy_ops(9)
  • struct phy_attrs(9)
  • struct phy_provider(9)
  • struct phy_lookup(9)

and that's the page!! πŸŽ‰ this one's sourced from the Kernel file ./include/linux/phy, dated October 2026 β€” so mark your calendar and stan responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from