of_alias_from_compatible(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, this is of_alias_from_compatible(9) from the Kernel API Manual, and she is literally the lookup icon for finding the appropriate alias for a device node depending on compatible ✨


✨ SYNOPSIS ✨

int of_alias_from_compatible (const struct device_node *node , char
       *alias , int len );

πŸŽ€ ARGUMENTS πŸŽ€

  • node β€” pointer to a device tree node. That’s the node we’re checking, periodt.
  • alias β€” pointer to the buffer that the alias value will be copied into. She’s the destination, bestie πŸ’…
  • len β€” length of the alias value. Gotta know how much room we’re working with 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

Based on the value of the compatible property, this routine will attempt to choose an appropriate alias value for a particular device tree node.

It does this by stripping the manufacturer prefix β€” as delimited by a ',' β€” from the first entry in the compatible list property. It’s giving β€œtake the product-side bit and use that as the alias” energy, lowkey iconic πŸ’«


⚠️ NOTE ⚠️

The matching on just the "product" side of the compatible is a relic from I2C and SPI. Please do not add any new user.

No cap, do not add a new user here πŸ™…β€β™€οΈ


🌈 RETURN 🌈

This routine returns 0 on success, <0 on failure. Slay when it’s 0, sad little <0 when it’s not 😭


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file: ./drivers/of/base.c


mwah πŸ’‹ this little page comes from ./drivers/of, dated October 2026, and the manual name is of_alias_from_compatible(9). bye bestie, go read some device tree nodes πŸ§šπŸ’œ

πŸ“¦ where this page comes from