pci_dev_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pci_dev_get(9) β€” from the Kernel API Manual, bestie πŸŽ€

okay so we're diving into the kernel API manual today and honestly? this one's a little baddie with a big job: it bumps the reference count on a pci_dev struct. that's it. that's the whole vibe. let's get into it ✨


🌸 NAME 🌸

pci_dev_get β€” increments the reference count of the pci device structure πŸ’–

like, it's giving "you're mine now and i'm keeping track of you" energy. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

struct pci_dev * pci_dev_get (struct pci_dev *dev );

one function, one argument, one pointer returned. clean, iconic, minimal. periodt.


✨ ARGUMENTS ✨

  • dev β€” the device being referenced 🫢 literally the pci device you're pledging your loyalty to.

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea, bestie: each live reference to a device should be refcounted. that's just how we do things around here β€” everybody keeping receipts on who's holding onto what πŸ“

drivers for PCI devices should normally record such references in their probe methods, when they bind to a device, and release them by calling pci_dev_put, in their disconnect methods. so like… pci_dev_get in probe, pci_dev_put in disconnect. a whole matching set, we love a coordinated moment πŸ’…πŸŒΈ

and finally: a pointer to the device with the incremented reference counter is returned ✨ so yes, you do get the pointer back, elevated, refcounted, main character energy πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/pci/pci-driver.c β€” go read the source, it's right there, iykyk πŸ‘€ β€” plus these absolutely iconic siblings:

the way this is a whole friend group of functions and pci_dev_put(9) is literally right there as the other half of the duo 😭🫢


okay that's the page!! this lil gem lives under ./drivers/pci, stamped October 2026, and it's filed as pci_dev_get(9) in case you need to find your way back πŸ’œ go forth and refcount responsibly, bestie 🧚✨

πŸ“¦ where this page comes from