devm_phy_optional_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 devm_phy_optional_get(9) 🌸

okay so bestie, welcome to the kernel API manual page for devm_phy_optional_get(9) β€” this is the devm_phy_optional_get one, fr fr, in the Kernel API Manual. yes it's the same name twice, the kernel is like that, we love a self-titled era. πŸ’…


✨ NAME ✨

devm_phy_optional_get β€” lookup and obtain a reference to an optional phy. that's it, that's the whole vibe. the word "optional" is doing SO much work here, remember it. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct phy * devm_phy_optional_get (struct device *dev , const char
*string );

πŸ’– ARGUMENTS πŸ’–

  • dev β€” the device that requests this phy. like, who's asking. it's you. you're the device. πŸ‘‘
  • string β€” the phy name as given in the dt data, or the phy device name for the non-dt case. iykyk which one applies to you. 🌈

πŸ”₯ DESCRIPTION πŸ”₯

so what does it actually DO. Gets the phy using phy_get, and then associates a device with it using devres. 🫢

On driver detach, release function is invoked on the devres data, then, devres data is freed. automatic cleanup, no cap, that's the whole devm lifestyle. ✨

Now the iconique part β€” the way this differs to devm_phy_get: 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. so you literally just hold your little NULL and keep going, slay. πŸ’€

ngl bestie, do NOT read "optional" and then panic about NULL checking β€” the manpage says the NULL phy can be passed to all other phy consumer calls, so that's the deal. just don't mix this up with devm_phy_get, which will absolutely hand you the -ENODEV. 😭

🌟 SEE ALSO 🌟

Kernel file ./drivers/phy/phy-core.c β€” that's where all of this lives, go look, it's giving source-of-truth. πŸ’œ


okay that's the whole page, no skips, no cuts, we ate. πŸ“

and for the cute sign-off: this one's filed under ./drivers/phy (that's the source/version bestie), dated October 2026, and it goes out as devm_phy_optional_get(9) β€” same name, top and bottom, main character energy from start to finish. mwah. πŸ’…πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from