This book's PCI chapter explain about:
int pci_enable_device(struct pci_dev *dev);
however there's also:
int pcim_enable_device (struct pci_dev * pdev);
But besides stating it's a "Managed pci_enable_device", it has no explanation.
pcim_enable_device()
is a managed version of pci_enable_device()
. Means that if you call pci_enable_device()
, you also need to call pci_disable_device()
in the end. In case of pcim_enable_device()
, managed framework will take care of disable operation for you.
In new kernel versions it is recommended to use such managed functions in order to get rid of error handling in your driver code. See this article to get a clue about device resource management (or devres) API. This particular function (pcim_enable_device
) was introduced in this patch. If you want to read more about devres framework, see Documentation/driver-model/devres.txt
The book you mentioned ("Linux Device Drivers, 3rd edition") doesn't have any explanation for managed functions, because it was written before those functions were implemented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With