of_phy_connect(9)
π of_phy_connect(9) π
okay bestie, so this is a page from the Kernel API Manual (section 9, the kernel developer one, iykyk) and it's literally about wiring your network device up to a PHY that the device tree told you about. it's giving "matchmaker but for hardware" π
β¨ NAME β¨
of_phy_connect β connect to the phy described in the device tree π¦
πΈ SYNOPSIS πΈ
struct phy_device * of_phy_connect (struct net_device *dev , struct
device_node *phy_np , void (*hndlr)(struct net_device *) , u32 flags ,
phy_interface_t iface );
π ARGUMENTS π
devβ pointer to thenet_devicethat's claiming the phy. like, this is the one putting a ring on it πphy_npβ pointer to the device tree node for the PHY. your PHY's little birth certificate, fr fr π³hndlrβ the link state callback for the network device. so it can hit you up when the link status changes πflagsβ flags to pass to the PHY π©ifaceβ the PHY data interface type. the whole vibe check of how data flows π
π DESCRIPTION π
so here's the tea: if it works, you get back a pointer to the phy_device, and the embedded struct device refcount is incremented by one β¨
if it doesn't work? you get NULL. no cap, that's the failure case π
β οΈ bestie listen β you must drop that refcount by callingphy_disconnectorphy_detach. don't just leave it hanging, that's leaked refcount energy and it's not cute π
π₯ SEE ALSO π₯
- Kernel file
./drivers/net/mdio/of_mdio.c __of_mdiobus_register(9)of_mdio_find_device(9)of_phy_find_device(9)of_phy_get_and_connect(9)
and that's the whole page, periodt π this lil icon lives over in ./drivers/net/mdio, dated October 2026 β go off bestie, may your refcounts always balance π«ΆπΈ
π¦ 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