__of_phy_provider_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __of_phy_provider_register β€” Kernel API Manual, bestie edition πŸŽ€

Okay so real talk, the manual name up top is Kernel API Manual, and today's main character is __of_phy_provider_register(9). Buckle up, this one's giving "I register PHY providers and I do it flawlessly" energy. ✨


🌸 NAME 🌸

__of_phy_provider_register β€” literally just create/register a phy provider with the framework. That's it. That's the whole vibe. πŸ¦‹


✨ SYNOPSIS ✨

struct phy_provider * __of_phy_provider_register (struct device *dev ,
       struct device_node *children , struct module *owner , struct phy *
       (*of_xlate)(struct device *dev, const struct of_phandle_args *args) );

Four args, one return, no cap. Copy it exactly, don't get cute with the signature. πŸ’œ


🫢 ARGUMENTS 🫢

  • dev β€” the struct device of the phy provider. Your provider's whole identity, honestly.
  • children β€” the device node that contains the children, if it's different from dev->of_node. Only relevant when your provider doesn't nest its children directly, iykyk.
  • owner β€” the module owner that contains of_xlate. Like, who do we blame / who gets pinned for the refcount. πŸ‘€
  • of_xlate β€” function pointer that obtains a phy instance from the phy provider. The little translator doing the actual work.

πŸ”₯ DESCRIPTION πŸ”₯

So it creates a struct phy_provider from dev and the of_xlate function pointer. That's the whole function, and honestly she ate. πŸŽ€

This is the one you use in the case of dt boot for finding the phy instance from the phy provider. No device tree, no party. 🌈

Now here's the nuance, and listen closely bestie because this is the part people fumble:

If the PHY provider doesn't nest children directly but uses a separate child node to contain the individual children, the children parameter can be used to override the default. Queen behavior, truly.

  • If children is NULL, the default (dev->of_node) will be used. Easy. Cozy. No notes. πŸ’–
  • If children is non-NULL, the device node must be a child (or further descendant) of dev->of_node.
⚠️ And if it's not? Then you get an ERR_PTR-encoded -EINVAL error code returned. Not me getting a -EINVAL in front of the whole group chat 😭 Pay attention to the parentage, fr fr.

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/phy/phy-core.c is the source of truth, and here's the whole extended friend group you should know about β€” no skips, we're listing every single one:

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), devm_of_phy_get_by_index(9), phy_create(9), devm_phy_create(9), phy_destroy(9), devm_phy_destroy(9), __devm_of_phy_provider_register(9), of_phy_provider_unregister(9), devm_of_phy_provider_unregister(9), phy_release(9)

Periodt. Go read them, they're all slay too. 🧚


✨ cute little sign-off ✨

This whole page lives in ./drivers/phy, dated October 2026, and it's all about __of_phy_provider_register(9) β€” that's the version, that's the source, that's the vibe. Go register some providers, bestie, and remember: the children node stays inside the family tree or it's -EINVAL for you. πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from