devm_of_phy_get_by_index(9)
π devm_of_phy_get_by_index(9) π
okay so welcome to the Kernel API Manual, bestie β buckle up, this one's short but she's mighty π¦
β¨ NAME β¨
devm_of_phy_get_by_index β lookup and obtain a reference to a phy by index π
like, you point at a phy by its number and it hands you a ref. that's the whole vibe check.
πΈ SYNOPSIS πΈ
struct phy * devm_of_phy_get_by_index (struct device *dev , struct device_node *np , int index );
yep, that's the whole signature β three args, one struct phy * coming back at you π
π«Ά ARGUMENTS π«Ά
devβ the device that requests this phy. she's the one asking, so she gets associated with the result β¨npβ the node containing the phy. this is where we go looking for it πindexβ index of the phy. literally just which one you want, by number π’
π DESCRIPTION π
so here's what actually happens, fr fr:
it gets the phy using _of_phy_get, then it gets a refcount to it, then it associates a device with it using devres. that's three whole steps, she's working π
and the iconic part? on driver detach, the release function is invoked on the devres data, and then the devres data is freed. automatic cleanup, no leaks, no manual phy_put panic at 3am β that's the devm main character energy right there π
no cap, the "devm" in the name is doing a LOT of heavy lifting here. it's giving "I'll handle it for you, bestie" π«Ά
π₯ SEE ALSO π₯
kernel file ./drivers/phy/phy-core.c, and literally the whole phy 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_get(9), devm_phy_optional_get(9), devm_of_phy_get(9), devm_of_phy_optional_get(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)
go read them all, i'll wait π
alright babe, that's the page π β brought to you from ./drivers/phy, dated October 2026, straight out of the Kernel API Manual. mwah π go get that phy π§ββοΈβ¨
π¦ 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