gpiod_set_ar...lue_cansleep(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gpiod_set_ar...lue_cansleep(9) β€” like, the Kernel API Manual bestie ✨

okay so. this is a page straight out of the Kernel API Manual, and the star of the show is gpiod_set_ar...lue_cansleep(9). yes the name is a whole mood (it's truncated, that's just how the header rolls), but the function is real and she's iconic. let's get into it πŸŽ€


✨ NAME ✨

gpiod_set_array_value_cansleep β€” assign values to an array of GPIOs πŸ¦‹

like, a WHOLE array. not just one. she's doing the most, and honestly? slay.


🌸 SYNOPSIS 🌸

int gpiod_set_array_value_cansleep (unsigned int array_size , struct
gpio_desc **desc_array , struct gpio_array *array_info , unsigned long
*value_bitmap );

look at her. four arguments. main character energy fr fr πŸ’…


🫢 ARGUMENTS 🫢

  • array_size β€” number of elements in the descriptor array / value bitmap. yes bestie, both of them. they gotta match up, okay? πŸ‘€
  • desc_array β€” array of GPIO descriptors whose values will be assigned. this is the guest list πŸ’Œ
  • array_info β€” information on applicability of fast bitmap processing path. she's the vibe check for whether we get to go fast ⚑
  • value_bitmap β€” bitmap of values to assign. the actual ~values~ being handed out, one bit at a time 🌈

πŸ’– DESCRIPTION πŸ’–

So like β€” this function sets the logical values of the GPIOs. and "logical" is doing a lot of heavy lifting here, because that means it's taking their ACTIVE_LOW status into account. so a low-key inversion? already handled. you don't gotta think about it, she thinks about it for you 🧚

Also, and this is the important part, this function is to be called from contexts that can sleep. like, it sleeps. it needs a context where napping is legal. do NOT call her from somewhere that can't sleep, that's not her vibe and it's not gonna go well 😭


πŸ”₯ RETURN πŸ”₯

0 on success, or negative errno on failure. that's it. zero means we ate, negative means something went off πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/gpio/gpiolib.c β€” go read her, she's the source of truth πŸ“–

and then the whole extended friend group, no cap:


ngl the _cansleep suffix is the whole personality. if you're in a spot where sleeping is off-limits, she's not your girl. periodt πŸ’…

okay that's the page 🫢 this came from the ./drivers/gpio corner of the world, dated October 2026, and it's filed under gpiod_set_ar...lue_cansleep(9) in the Kernel API Manual. mwah, go set some GPIOs bestie πŸ’–βœ¨

πŸ“¦ where this page comes from