devm_gpiod_get_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– devm_gpiod_get_array(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so real talk, this is a page from the Kernel API Manual and it's all about devm_gpiod_get_array(9). yes the title is the same as the function name, that's just how manpages are, it's giving "my name is my name" energy πŸ’…


✨ NAME ✨

devm_gpiod_get_array β€” it's the resource-managed version of gpiod_get_array(), like the one with a built-in cleanup crew 🧹✨


🌸 SYNOPSIS 🌸

struct gpio_descs * devm_gpiod_get_array (struct device *dev , const
char *con_id , enum gpiod_flags flags );

that's it, that's the whole thing. three args, one struct pointer coming back out, we love a simple signature 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the GPIO consumer, aka the device that's out here consuming GPIOs. main character of the operation ngl πŸ‘‘
  • con_id β€” the function within the GPIO consumer. so like, which job is this pin doing? that's the vibe check.
  • flags β€” optional GPIO initialization flags. optional!! but still important, don't skip leg day πŸ‹οΈ

πŸ’€ DESCRIPTION πŸ’€

so this is the managed gpiod_get_array(). and "managed" here literally means the GPIO descriptors you get back from this function are automatically disposed on driver detach β€” like they clean themselves up when the driver peaces out, no manual put required πŸ˜­πŸ™

for the full tea on behavior and return values, go read gpiod_get_array. this one is not out here reinventing the wheel, it's just the safety-net version, periodt.


πŸ”₯ RETURN πŸ”₯

here's what you might get back:

  • the GPIO descriptors corresponding to the function con_id of device dev β€” the good ending 🌈
  • -ENOENT if no GPIO has been assigned to the requested function β€” i.e. nothing's there, bestie, it's empty πŸ’€
  • or another IS_ERR code if an error occurred while trying to acquire the GPIOs
fr fr check that return value. don't just assume it worked, that's how you end up debugging at 3am πŸ™ˆ

⭐ SEE ALSO ⭐

peep these next, iykyk:


and that's the whole page!! πŸŽ€ this lil guy lives over in ./drivers/gpio, the manual's dated October 2026, and it's filed under devm_gpiod_get_array(9) β€” go forth and acquire those GPIO arrays responsibly, bestie πŸ’œπŸ¦‹

πŸ“¦ where this page comes from