devm_usb_get_phy_by_node(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devm_usb_get_phy_by_node(9) β€” the kernel API manual, but make it make sense ✨

okay so bestie, welcome to the kernel API manual page for devm_usb_get_phy_by_node. yes it's a mouthful, yes we're gonna get through it together 🫢 this one lives down in ./drivers/usb/phy and it's lowkey iconic if you're into charger drivers.


🌸 NAME 🌸

devm_usb_get_phy_by_node β€” find the USB PHY by device_node πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

struct usb_phy * devm_usb_get_phy_by_node (struct device *dev , struct device_node *node , struct notifier_block *nb );

like, that's the whole signature, no cap. three args, one pointer back out ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the device that requests this phy, bestie. it's the one asking, okay?
  • node β€” the device_node for the phy device. this is who we're looking up πŸ”
  • nb β€” a notifier_block to register with the phy. yes you gotta hand it over, that's the vibe πŸ“¨

πŸ’– DESCRIPTION πŸ’–

so here's the tea β˜•: this function returns the phy driver associated with the given device_node, after getting a refcount to it. refcount = it's officially yours now, keep track of it, don't be weird about it πŸ”₯

but there are plot twists, obviously:

  • it returns -ENODEV if there is no such phy 😭
  • it returns -EPROBE_DEFER if the device is not yet loaded ⏳

while it's at it, it also associates the device with the phy using devres. very multitasking of it, honestly πŸ’… and here's why that matters: on driver detach, the release function is invoked on the devres data, and then the devres data is freed. automatic cleanup, we love to see it 🧹✨

for use by peripheral drivers for devices related to a phy, such as a charger. like, that's the whole audience. if that's you, hi, this one's your main character energy πŸ‘‘

🌈 SEE ALSO 🌈

kernel file ./drivers/usb/phy/phy.c, plus the whole friend group:

go read them, iykyk πŸ“šπŸ’œ


✿ and that's the page, bestie ✿ this gem shipped from ./drivers/usb/phy in October 2026, so when you see that date in the footer of your terminal, that's me waving at you πŸ‘‹πŸ’– slay, go get your phy πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from