devm_usb_get_phy_by_phandle(9)
π devm_usb_get_phy_by_phandle(9) π
okay so bestie, welcome to the Kernel API Manual β this one's all about devm_usb_get_phy_by_phandle, and it's genuinely so useful, let me tell you everything β¨
β¨ NAME β¨
devm_usb_get_phy_by_phandle β find the USB PHY by phandle π
π¦ SYNOPSIS π¦
struct usb_phy * devm_usb_get_phy_by_phandle (struct device *dev , const
char *phandle , u8 index );
πΈ ARGUMENTS πΈ
devβ the device that's requesting this phy, like it's the one doing the asking πphandleβ the name of the property that's holding the phy phandle value, iykykindexβ the index of the phy, yes there can be a whole lineup π«Ά
π₯ DESCRIPTION π₯
So here's the vibe: this returns the phy driver that's associated with the given phandle value, after getting a refcount to it. Iconic. But also β it returns -ENODEV if there's no such phy, or -EPROBE_DEFER if there is a phandle to the phy but the device isn't loaded yet. Not me being dramatic, that's literally the deal π
While it's at it, it also associates the device with the phy using devres. And on driver detach? The release function is invoked on the devres data, then the devres data is freed. Cleanup queen behavior, honestly π
For use by USB host and peripheral drivers. That's the whole audience, no gatekeeping.
π 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_node(9)usb_put_phy(9)usb_add_phy(9)usb_add_phy_dev(9)usb_remove_phy(9)usb_phy_set_event(9)
ngl bestie, always check your return value β-ENODEVand-EPROBE_DEFERare two very different moods and you don't wanna mix them up π
okay that's the whole page, mwah π β this gem lives in ./drivers/usb/phy, dated October 2026, and it's called devm_usb_get_phy_by_phandle(9) in case you forgot already. slay, go write some drivers π§ββοΈπ
π¦ 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