devm_usb_get_phy_by_node(9)
π 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β thedevice_nodefor the phy device. this is who we're looking up πnbβ anotifier_blockto 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
-ENODEVif there is no such phy π - it returns
-EPROBE_DEFERif 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:
usb_phy_notify_charger_work(9)usb_phy_get_charger_type(9)usb_phy_set_charger_current(9)usb_phy_get_charger_current(9)usb_phy_set_charger_state(9)devm_usb_get_phy(9)usb_get_phy(9)devm_usb_get_phy_by_phandle(9)usb_put_phy(9)usb_add_phy(9)usb_add_phy_dev(9)usb_remove_phy(9)usb_phy_set_event(9)
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
- 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