gpiod_get_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– gpiod_get_index(9) β€” Kernel API Manual πŸ’–

okay so bestie, welcome to the Kernel API Manual entry for gpiod_get_index(9), aka the glow-up version of grabbing a GPIO when your function has several of them and you don't just want the first one. sit down, grab a strawberry πŸ“, let's go.


✨ NAME ✨

gpiod_get_index β€” obtain a GPIO from a multi-index GPIO function πŸŽ€


🌸 SYNOPSIS 🌸

struct gpio_desc * gpiod_get_index (struct device *dev , const char
*con_id , unsigned int idx , enum gpiod_flags flags );

like, that's the whole vibe. iconic signature, no notes πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the GPIO consumer. yes bestie, it can literally be NULL if you're doing system-global GPIOs. main character energy, lowkey unhinged, but valid. πŸ™ˆ
  • con_id β€” the function within the GPIO consumer. it's giving "which one of my many jobs is this". πŸ’Ό
  • idx β€” the index of the GPIO you wanna obtain in the consumer. this is the whole point of the function, fr fr. πŸ”’
  • flags β€” optional GPIO initialization flags. optional, but they can absolutely ate. ✨

πŸ’œ DESCRIPTION πŸ’œ

so this variant of gpiod_get is the one you call when you want to access GPIOs other than the first defined one β€” specifically for functions that define several GPIOs. no cap. if your function's got one lonely GPIO, gpiod_get has you covered; the moment it's a whole squad, that's gpiod_get_index's moment to shine πŸ‘‘

lowkey the whole flex here: it's not a different API, it's the same API with an index. same brain, more options. iykyk 🧚

πŸ”₯ RETURN πŸ”₯

  • a valid GPIO descriptor β€” slay, you got it πŸ’–
  • -ENOENT β€” no GPIO has been assigned to the requested function and/or index. so like... nobody's home. 😭
  • or another IS_ERR code β€” if an error occurred while trying to acquire the GPIO. read it, don't ignore it bestie, that's the vibe check 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./drivers/gpio/gpiolib.c β€” plus, and i mean this literally, the entire extended universe:

like, that's the whole friend group. go say hi 🌈


source directory: ./drivers/gpio 🌸 β€” dated October 2026 πŸŽ€

and that's the page bestie!! you understood it, i'm obsessed, periodt πŸ’…βœ¨πŸ¦‹ go forth and index responsibly πŸ’–

πŸ“¦ where this page comes from