devm_of_phy_optional_get(9)
π 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 phycon_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:
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_get(9)devm_phy_optional_get(9)devm_of_phy_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)
π 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
- 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