devm_phy_get(9)
β¨ devm_phy_get(9) β¨
okay so real talk, bestie β this is a page straight out of the Kernel API Manual, and it's genuinely one of the more useful little gremlins in the PHY world. it's devm_phy_get(9), and no cap, it's the "grab a phy and let the kernel clean up after you" girlie. let's get into it π
πΈ NAME πΈ
devm_phy_get β lookup and obtain a reference to a phy. that's it, that's the whole vibe. she finds the phy and she holds a reference to it π«Ά
π SYNOPSIS π
struct phy * devm_phy_get (struct device *dev , const char *string );
look at her. one struct, one device, one string, one return. clean lines, main character energy β¨
π ARGUMENTS π
devβ the device that requests this phy. like, who's asking. this is the one that gets tied to the devres magic later, so she matters πstringβ the phy name as given in the dt data, or the phy device name for the non-dt case. so basically: if you're coming from device tree, it's the dt name; if you're not, it's the phy device's own name. either way, this is how you tell her which phy you want π¦
π₯ DESCRIPTION π₯
so here's the tea π β this function gets the phy using phy_get, and then associates a device with it using devres. that's the whole point of the devm_ prefix btw, iykyk.
and the best part? on driver detach, the release function is invoked on the devres data, and then the devres data is freed. so the cleanup literally handles itself, which is honestly iconic behavior. no manual free-and-pray required π
note the order, bestie β release function first, then the free. that sequence is not decorative, ok? respect the sequence π
π SEE ALSO π
kernel file ./drivers/phy/phy-core.c
and the whole extended friend group:
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)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)
like, that's the whole group chat and every single one of them is invited to the function reference party π§π
and that's the page, bestie!! this one came to you from the source ./drivers/phy, dated October 2026, and yes she still signs off as devm_phy_get(9) because legends don't change their name π
β¨ see you in the next man page, mwah π
π¦ 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