for_each_hwgpio_in_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… for_each_hwgpio_in_range(9) β€” from the Kernel API Manual, bestie ✨

Okay so picture this: it's you, a gpio_chip, and a whole range of GPIOs that need iterating. This macro is your girl. It iterates over all GPIOs in a given range, no cap, and honestly? Iconic behaviour. πŸŽ€


🌸 SYNOPSIS 🌸

for_each_hwgpio_in_range (_chip , _i , _base , _size , _label );

That's literally the whole invocation. Five args. Eat it up. πŸ“


✨ ARGUMENTS ✨

  • _chip β€” the chip you're iterating over. The motherboard main character energy. πŸ‘‘
  • _i β€” the loop counter. She's counting, she's keeping track, she's doing the work behind the scenes. πŸ’…
  • _base β€” the first GPIO in the ranger. (And yes, the manpage really says "ranger" β€” not range β€” that's canon now, we're keeping it, love her for it 🫢)
  • _size β€” how many GPIOs to check, starting from _base. Like, the size of the squad. 🌈
  • _label β€” the place where you store the address of the label if the GPIO is requested. Aka: if somebody's using it, you get the name. And for unused GPIOs? Set it to NULL. Empty slot, no drama, moving on. ⭐
πŸ’€ Real talk: _label only gets a label when the GPIO is requested β€” for unused ones it's NULL. Don't go reading it expecting a name that isn't there.

πŸ‘€ SEE ALSO πŸ‘€

All the besties in the same friend group:


πŸ’– that's the page, bestie β€” go iterate slayfully πŸ’–

Dropping this from ./include/linux/gpio, dated October 2026, and it's signed the for_each_hwgpio_in_range(9) way. πŸ¦‹ Not me getting emotional over a kernel macro. 😭

πŸ“¦ where this page comes from