STRUCT GPIO_DESC(9)
π struct gpio_desc(9) β like, the actual Kernel API Manual, bestie β¨
okay so we're in the Kernel API Manual today and the main character is struct gpio_desc β the opaque descriptor for a GPIO π no cap, that's the whole vibe.
π NAME π
struct gpio_desc β an opaque descriptor for a GPIO. that's it, that's the tweet π¦
β¨ SYNOPSIS β¨
here's the whole glow-up, copy it exactly, don't touch a single space or the compiler WILL clock you π
struct gpio_desc {
struct gpio_device *gdev;
unsigned long flags;
#define GPIOD_FLAG_REQUESTED 0 ;
#define GPIOD_FLAG_IS_OUT 1 ;
#define GPIOD_FLAG_EXPORT 2 ;
#define GPIOD_FLAG_SYSFS 3 ;
#define GPIOD_FLAG_ACTIVE_LOW 6 ;
#define GPIOD_FLAG_OPEN_DRAIN 7 ;
#define GPIOD_FLAG_OPEN_SOURCE 8 ;
#define GPIOD_FLAG_USED_AS_IRQ 9 ;
#define GPIOD_FLAG_IRQ_IS_ENABLED 10 ;
#define GPIOD_FLAG_IS_HOGGED 11 ;
#define GPIOD_FLAG_TRANSITORY 12 ;
#define GPIOD_FLAG_PULL_UP 13 ;
#define GPIOD_FLAG_PULL_DOWN 14 ;
#define GPIOD_FLAG_BIAS_DISABLE 15 ;
#define GPIOD_FLAG_EDGE_RISING 16 ;
#define GPIOD_FLAG_EDGE_FALLING 17 ;
#define GPIOD_FLAG_EVENT_CLOCK_REALTIME 18 ;
#define GPIOD_FLAG_EVENT_CLOCK_HTE 19 ;
#define GPIOD_FLAG_SHARED 20 ;
#define GPIOD_FLAG_SHARED_PROXY 21 ;
struct gpio_desc_label *label;
const char *name;
#ifdef CONFIG_OF_DYNAMIC;
struct device_node *hog;
#endif;
#ifdef CONFIG_GPIO_CDEV;
unsigned int debounce_period_us;
#endif;
};
π«Ά Members π«Ά
the whole squad, one by one, iykyk:
gdevβ pointer to the parent GPIO device. the mothership πΈflagsβ binary descriptor flags. yes, binary, as in bits go brrr π₯labelβ name of the consumer. who's using this line, fr frnameβ line name. the line's own little name tag π·οΈhogβ pointer to the device node that hogs this line (if any). greedy little thing, love that for it πdebounce_period_usβ debounce period in microseconds. tiny tiny time, iconic β±οΈ
π Description π
okay so the lore: these are obtained using gpiod_get and are preferable to the old integer-based handles. we don't do integer handles anymore bestie, that's so last season π
and here's the part that eats: contrary to integers, a pointer to a struct gpio_desc is guaranteed to be valid until the GPIO is released. so you can hold onto it like a best friend promise π«Ά lowkey the whole point.
π SEE ALSO π
go read these next, bestie, i'm obsessed:
- Kernel file
./drivers/gpio/gpiolib.h struct gpio_device(9)struct gpio_array(9)
ngl the descriptor is opaque β so like, admire it from the outside, don't go poking at its internals like it's your business. π§
and that's the page, periodt π this cutie lives in ./drivers/gpio and it's dated October 2026 β struct gpio_desc(9), slay, bye π
π¦ 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