admin管理员组文章数量:1123508
I'm facing a compilation issue with the pci_reset_bus
function.
In kernel versions 4.19-rc1 and later, the function signature is:
int pci_reset_bus(struct pci_dev *dev);
In kernel versions prior to 4.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:
- SLES 15.1 with kernel
4.12.14-195-default
uses the new signature (int pci_reset_bus(struct pci_dev *dev)
). - Fedora 27 with kernel
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 4.19 as we see in SLES 15.1.
My questions:
- What is the best way to determine the correct signature of
pci_reset_bus
? - 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.
本文标签: linuxHow to identify the signature of pciresetbus funtcionStack Overflow
版权声明:本文标题:linux - How to identify the signature of pci_reset_bus funtcion - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736577849a1944896.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论