PCI_FIND_NEXT_CAP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… PCI_FIND_NEXT_CAP(9) β€” like, the kernel API manual bestie πŸ’–

okay so this is a page from the Kernel API Manual, and we're talking about PCI_FIND_NEXT_CAP β€” the little macro that goes hunting for a PCI standard capability. no cap, it's lowkey iconic once you get it. let's go 🫢


✨ NAME ✨

PCI_FIND_NEXT_CAP β€” bestie's official way to find a PCI standard capability πŸŽ€


🌸 SYNOPSIS 🌸

PCI_FIND_NEXT_CAP (read_cfg , start , cap , prev_ptr , args... );

literally just call it like that, exactly like that, don't get cute with it πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • read_cfg β€” a function pointer for reading PCI config space. yes, pointer to a function, it's giving callback energy πŸ‘‘
  • start β€” the starting position where the search begins. where we're picking up the hunt πŸ”₯
  • cap β€” the capability ID you're trying to find. the whole reason we're here πŸ’–
  • prev_ptr β€” a pointer used to store the position of the preceding capability. (optional, so no pressure 😌)
  • args β€” the arguments you pass along to the read_cfg function. hand them over, she'll deal with it πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so basically she searches the capability list in PCI config space looking for cap. super chill, super focused 🧚

if it's found, she updates *prev_ptr with the position of the preceding capability β€” but only if prev_ptr != NULL, okay? don't come for her if you passed a null, she checked πŸ™ˆ

and the best part: it implements TTL (time-to-live) protection against infinite loops. so if the capability list is being a messy little gremlin and looping forever, TTL says "not today bestie" and stops it πŸ’€πŸ”₯


⭐ RETURN ⭐

you get the position of the capability if it's found β€” and 0 otherwise. that's it, that's the whole vibe check βœ…


🌈 SEE ALSO 🌈

kernel file ./drivers/pci/pci.h, plus the whole friend group:

and the directory squad: ./drivers/pci 🫢


that's the whole page, bestie β€” go find those capabilities, slay, and remember: TTL said no infinite loops in this house πŸ’…βœ¨

signing off from ./drivers/pci, dated October 2026, per the PCI_FIND_NEXT_CAP(9) era of the Kernel API Manual β€” ily, stay iconic πŸŽ€πŸ’–

πŸ“¦ where this page comes from