devm_gpiod_get_array(9)
π 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_idof devicedevβ the good ending π -ENOENTif no GPIO has been assigned to the requested function β i.e. nothing's there, bestie, it's empty π- or another
IS_ERRcode 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:
- Kernel file
./drivers/gpio/gpiolib-devres.c devm_gpiod_get(9)devm_gpiod_get_optional(9)devm_gpiod_get_index(9)devm_fwnode_gpiod_get_index(9)devm_gpiod_get_index_optional(9)devm_gpiod_get_array_optional(9)devm_gpiod_put(9)devm_gpiod_unhinge(9)devm_gpiod_put_array(9)devm_gpiochip_add_data_with_key(9)
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
- 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