STRUCT PCI_PWRCTRL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct pci_pwrctrl β€” the Kernel API Manual, but make it make sense

okay bestie so the manual name is struct pci_pwrctrl, and yes she's from the Kernel API Manual section 9 β€” the big-girl section for kernel internals, periodt. this whole page is about a PCI device power control context, and honestly? it's giving "small struct, huge responsibility." πŸŽ€


✨ NAME ✨

struct pci_pwrctrl β€” the PCI device power control context. that's it, that's the vibe. it's the little object that holds the power-controlling device and the two callbacks that turn it on and off. iconic behavior tbh πŸ¦‹


🌸 SYNOPSIS 🌸

here's what she looks like, literally verbatim, no notes, copy her exactly:

struct pci_pwrctrl {
    struct device *dev;
    int (*power_on)(struct pci_pwrctrl *pwrctrl);
    int (*power_off)(struct pci_pwrctrl *pwrctrl);
 };

three members. that's the whole struct. short but slaying πŸ’–


πŸ‘‘ Members πŸ‘‘

each one gets her moment, bestie:

  • dev β€” address of the power controlling device. like, where it lives. the address. of the power controlling device. πŸ’…
  • power_on β€” callback to power on the power controlling device. she does exactly what it says on the tin. ⭐
  • power_off β€” callback to power off the power controlling device. the opposite of the one above, and she's just as important. πŸ’€

🧚 Description 🧚

okay so here's the lore. an object of this type must be allocated by the PCI power control device β€” like, that's a hard requirement, "must," no cap β€” and then passed to the pwrctrl subsystem.

and what does the pwrctrl subsystem do with it? two things, bestie, and they're both kind of a big deal:

  1. it triggers a bus rescan πŸ”₯
  2. it sets up a device link with the device once it's up 🌈

so yeah. allocate it in the PCI power control device, hand it over to pwrctrl, and let the subsystem do her thing. that's the whole flow. iykyk 🫢

like for real though β€” the "must be allocated by the PCI power control device" part is not a suggestion, it's the rule. don't be out here allocating this thing in random places and expecting it to work πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

one (1) whole reference, and here she is:

  • Kernel file ./include/linux/pci-pwrctrl.h β€” go read the header, the header knows all πŸ“

πŸŒΈβœ¨πŸ’œ that's the page!! this came to you from the ./include/linux desk, and the date on it is October 2026, so mark your calendars bestie. mwah, go power-cycle something responsibly πŸ’…πŸŽ€β­

πŸ“¦ where this page comes from