devm_of_phy_get_by_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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