devm_of_phy_optional_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– devm_of_phy_optional_get(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual entry for devm_of_phy_optional_get(9) β€” yes the title is the function name, yes it's a mouthful, we're gonna get through it together 🫢


✨ NAME ✨

devm_of_phy_optional_get β€” look up and grab a reference to an optional phy πŸ’…


🌸 SYNOPSIS 🌸

struct phy * devm_of_phy_optional_get (struct device *dev , struct device_node *np , const char *con_id );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device that's requesting this phy, like it's putting in an order πŸ›οΈ
  • np β€” the node that's holding the phy
  • con_id β€” the name of the phy from the device's point of view (yes, perspective matters, it's giving main character energy)

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this gets the phy using of_phy_get, and associates a device with it using devres. Then on driver detach, the release function is invoked on the devres data, and after that the devres data is freed. Cleanup? Handled. Obsessed. ✨

Now the part that makes this one special β€” this differs to devm_of_phy_get in that if the phy does not exist, it is not considered an error, and -ENODEV will not be returned. Instead the NULL phy is returned, which can be passed to all other phy consumer calls. no cap, that's the whole point 🫢

lowkey important: NULL here is a legit, valid answer. don't panic when you see it πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./drivers/phy/phy-core.c β€” and honestly the whole friend group showed up:


πŸŽ€ and that's the page!! brought to you straight from ./drivers/phy, October 2026, Kernel API Manual edition β€” go forth and get your optional phys, bestie, ily πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from