Reputation: 393
I'm facing a compilation issue with the pci_reset_bus()
function.
In kernels v4.19-rc1 and later, the function signature is:
int pci_reset_bus(struct pci_dev *dev);
In kernels prior to v4.19-rc1, the signature was:
int pci_reset_bus(struct pci_bus *bus);
The problem is that I have a character device driver that uses this function and needs to compile across various Linux distributions. for example:
4.12.14-195-default
uses the new signature: int pci_reset_bus(struct pci_dev *dev)
.4.13.9
also uses the new signature.Here is the current code I have:
int nnt_pci_reset_bus(struct pci_dev *pci_device)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || (defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= 2048)
return pci_reset_bus(pci_device);
#else
return pci_reset_bus(pci_device->bus);
#endif
}
This doesn't work because the function signature cannot be determined even for older kernel versions below v4.19 as we see in SLES 15.1.
pci_reset_bus()
?Looking for a robust method to make this code work universally across different kernels.
Upvotes: 0
Views: 45