STRUCT PHY(9)
π 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 protectphy_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_countandpower_countare 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
- 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