1
0
forked from pool/virtualbox
virtualbox/fixes_for_4.17.patch

32 lines
1.4 KiB
Diff

In kernel 4.17, pci_get_bus_and_slot() has been removed in favor of
pci_get_domain_bus_and_slot(). It appears that VirtualBox only uses
domain number 0, thus pci_get_domain_bus_and_slot(0, bus, devfn)
is a suitable replacement for pci_get_bus_and_slot(bus, devfn).
The resulting code compiles; however, I do not use PCI passthru, which
I think means that I have not actually tested the code.
This patch released under a combined MIT/GPLv2 license.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Index: VirtualBox-5.2.8/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
===================================================================
--- VirtualBox-5.2.8.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
+++ VirtualBox-5.2.8/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
@@ -89,7 +89,14 @@ MODULE_VERSION(VBOX_VERSION_STRING " r"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
# define PCI_DEV_GET(v,d,p) pci_get_device(v,d,p)
# define PCI_DEV_PUT(x) pci_dev_put(x)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+/* assume the domain number to be zero - exactly the same assumption of
+ * pci_get_bus_and_slot()
+ */
+# define PCI_DEV_GET_SLOT(bus, devfn) pci_get_domain_bus_and_slot(0, bus, devfn)
+#else
# define PCI_DEV_GET_SLOT(bus, devfn) pci_get_bus_and_slot(bus, devfn)
+#endif
#else
# define PCI_DEV_GET(v,d,p) pci_find_device(v,d,p)
# define PCI_DEV_PUT(x) do { } while (0)