pciehp_card_..._link_active(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, so this is a page from the Linux Kernel API Manual, and it's about one very specific little helper function. it's short, it's iconic, and honestly it's doing the most for those cursed hotplug ports. let's get into it πŸ’…


✨ NAME ✨

pciehp_card_present_or_link_active β€” tells you whether a given slot is occupied or not, no cap 🫢


🌸 SYNOPSIS 🌸

int pciehp_card_present_or_link_active (struct controller *ctrl );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • ctrl β€” the PCIe hotplug controller, aka the main character of this whole situation πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

so here's the teaaaa πŸ“. there's this other function, pciehp_card_present, and the way that one figures out if a card is there is by looking at the Presence Detect State bit, and only that bit. like, that's its whole personality.

but this helper? she's built different. pciehp_card_present_or_link_active also returns true if the Link Active bit is set. highkey generous of her.

and why, you ask? because some hotplug ports are lowkey broken 😭 β€” they hardwire Presence Detect State to zero, so it's always like "nobody's home" even when somebody absolutely is. the page literally calls this a concession to broken hotplug ports, and gives Wilocity's [1ae9:0200] as the example of one of these messy ports. so yeah, she checks both because somebody has to πŸ’€


⭐ RETURN ⭐

  • 1 β€” the slot is occupied, we love to see it πŸ’–
  • 0 β€” the slot is not occupied, nothing to see here πŸ™ˆ
  • -ENODEV β€” returned if the hotplug port is not present anymore 🫠

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/pci/hotplug/pciehp_hpc.c, plus her besties:


and that's the whole page, bestie, you ate that 🧚✨. this one lives over in ./drivers/pci/hotplug and it's dated October 2026 β€” so go forth, check that link, and slay πŸ’…πŸ‘‘

πŸ“¦ where this page comes from