Itay Avraham
Itay Avraham

Reputation: 393

How to identify the signature of pci_reset_bus()

I'm facing a compilation issue with the pci_reset_bus() function.

The problem is that I have a character device driver that uses this function and needs to compile across various Linux distributions. for example:

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.

My questions:

  1. What is the best way to determine the correct signature of pci_reset_bus()?
  2. What is the most reliable solution to handle this situation for different kernel versions and distributions?

Looking for a robust method to make this code work universally across different kernels.

Upvotes: 0

Views: 45

Answers (0)

Related Questions