of_property...string_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_property...string_index(9) πŸ’…

ok so this is a page straight out of the Kernel API Manual β€” yes bestie, the kernel has a manual, and yes it's giving "ancient scroll but make it devices" 🧚✨. We're talking about of_property_read_string_index, and honestly? She's a little niche queen and I'm obsessed. Let's get into it πŸŽ€


✨ NAME ✨

of_property_read_string_index β€” find and read a single string out of a property that holds multiple strings. iykyk 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

int of_property_read_string_index (const struct device_node *np ,
                                   const char *propname , int index ,
                                   const char **output );

πŸ’– ARGUMENTS πŸ’–

  • np β€” the device node you're reading the property value from. like, the source of truth, the main character πŸ‘‘
  • propname β€” the name of the property you're searching for πŸ”
  • index β€” which string you want, out of the whole list of strings. it's an index, it indexes, she indexes πŸ’…
  • output β€” a pointer to a null-terminated return string. heads up: this only gets modified if the return value is 0. no sneaky writes otherwise, periodt 🫢

🌈 DESCRIPTION 🌈

So what she does: you search for a property inside a device tree node, and she retrieves a null-terminated string value from the list of strings contained in that property. and bestie, listen β€” it's a pointer to data, not a copy. no duplicating, we're not doing that here ✨

The out_string pointer is modified only if a valid string can be decoded. like, she's not gonna hand you garbage and call it a day πŸ’€

fr fr, don't touch that pointer and expect it to be valid unless you got a 0 back. that's the whole vibe check 😭

πŸ”₯ RETURN πŸ”₯

  • 0 β€” success, slay, we ate πŸŽ‰
  • -EINVAL β€” the property does not exist πŸ™ˆ
  • -ENODATA β€” the property exists but doesn't have a value 🫠
  • -EILSEQ β€” the string is not null-terminated within the length of the property data πŸ˜­πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/of.h β€” and here's the whole squad, no cap, every single one of them:


ok that's the whole page, and honestly she ate πŸ’… this one lives in ./include/linux, dated October 2026, and the page itself is of_property...string_index(9). bye bestie, go read some device trees πŸŒΈπŸ¦‹πŸ’œ

πŸ“¦ where this page comes from