phy_get(9)
π phy_get(9) β from the Kernel API Manual, bestie π
Okay so real talk, this is a page out of the Kernel API Manual, and it's about one tiny little function that does one huge job: grabbing you a phy and holding onto it. No cap, it's giving "let me introduce you to your new phy" energy.
β¨ NAME β¨
phy_get β lookup and obtain a reference to a phy. π¦
Like, it goes and finds the phy for you and then keeps a little counter so nobody yanks it away while you're using it. Iconic behaviour honestly.
πΈ SYNOPSIS πΈ
struct phy * phy_get (struct device *dev , const char *string );
That's the whole vibe. Two args, one struct phy * back. Periodt. π
π ARGUMENTS π
devβ the device that requests this phy π β like, this is the one asking, so the kernel knows who's claiming it.stringβ the phy name as given in the dt data, or the name of the controller port for the non-dt case β β two ways to say who you want, depends on whether you're living that device-tree life or not.
π₯ DESCRIPTION π₯
So here's the tea: phy_get returns the phy driver, after getting a refcount to it π«Ά β or it hands you back -ENODEV if there is no such phy π. Meaning: if it exists, it's yours (with a nice little reference count holding it in place). If it doesn't exist? You get -ENODEV and you deal with it.
β οΈ Important bestie note: the caller is responsible for calling phy_put to release that count. Do not forget. That refcount is not gonna release itself, and leaking it is not the main character move you think it is π.
π SEE ALSO π
Kernel file ./drivers/phy/phy-core.c β that's the source, go read it, it's literally right there iykyk π
And the whole friend group of related calls, because phy_get never travels alone:
phy_create_lookup(9)phy_remove_lookup(9)phy_init(9)phy_exit(9)phy_power_on(9)phy_power_off(9)phy_calibrate(9)phy_notify_connect(9)phy_notify_disconnect(9)phy_notify_state(9)phy_configure(9)phy_validate(9)_of_phy_get(9)of_phy_get(9)of_phy_put(9)phy_put(9)devm_phy_put(9)of_phy_simple_xlate(9)devm_phy_get(9)devm_phy_optional_get(9)devm_of_phy_get(9)devm_of_phy_optional_get(9)devm_of_phy_get_by_index(9)phy_create(9)devm_phy_create(9)phy_destroy(9)devm_phy_destroy(9)__of_phy_provider_register(9)__devm_of_phy_provider_register(9)of_phy_provider_unregister(9)devm_of_phy_provider_unregister(9)phy_release(9)
That's the whole page, bestie, you ate it up πβ¨
π Cute lil sign-off: this one lives in./drivers/phy, dated October 2026. Go forth andphy_putresponsibly π§π
π¦ 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