gpio_device_find(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gpio_device_find(9) β€” find a specific GPIO device πŸ’…

hey bestie, welcome to the gpio_device_find(9) page from the Kernel API Manual ✨ this is the whole vibe for finding a specific GPIO device, and we're gonna get into it. πŸŽ€


🌸 NAME 🌸

gpio_device_find β€” find a specific GPIO device

no cap, that's the whole name section: this helper is here to find a specific GPIO device. πŸ’–


✨ SYNOPSIS ✨

okay so the signature is literally this, bestie β€” keep it exact:

struct gpio_device * gpio_device_find (const void *data , int
       (*match)(struct gpio_chip *gc, const void *data) );

πŸŽ€ ARGUMENTS πŸŽ€

  • data β€” the data to pass to the match function. πŸ¦‹
  • match β€” callback function to check gpio_chip. πŸ’…

πŸ’– RETURN πŸ’–

New reference to struct gpio_device. that's the return, bestie β€” a fresh reference, periodt. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is similar to bus_find_device. it returns a reference to a gpio_device as determined by a user supplied match callback. ✨

the callback should return 0 if the device doesn't match and non-zero if it does. if the callback returns non-zero, this function will return to the caller and not iterate over any more gpio_devices. 🎯

the callback takes the GPIO chip structure as argument. during the execution of the callback function the chip is protected from being freed. πŸ›‘οΈ

🚨 TODO: This actually has yet to be implemented. bestie, that's the literal caveat β€” don't forget it. πŸ’€

if the function returns non-NULL, the returned reference must be freed by the caller using gpio_device_put. please don't ghost your reference, that's not the move. πŸ™ˆ


🌈 SEE ALSO 🌈

the kernel file is ./drivers/gpio/gpiolib.c, and here's the full cross-reference bestie list β€” every single one, no skips. πŸ‘‘


and that's the page, bestie 🫢 β€” source: ./drivers/gpio Β· manual/version: Kernel API Manual Β· date: October 2026. periodt. πŸ’…

πŸ“¦ where this page comes from