devm_phy_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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:

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