19 lines
464 B
Diff
19 lines
464 B
Diff
--- a/bbswitch.c
|
|
+++ b/bbswitch.c
|
|
@@ -264,10 +264,14 @@
|
|
pci_disable_device(dis_dev);
|
|
do {
|
|
struct acpi_device *ad = NULL;
|
|
- int r;
|
|
+ int r = 0;
|
|
|
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
|
+ ad = acpi_fetch_acpi_dev(dis_handle);
|
|
+#else
|
|
r = acpi_bus_get_device(dis_handle, &ad);
|
|
+#endif
|
|
if (r || !ad) {
|
|
pr_warn("Cannot get ACPI device for PCI device\n");
|
|
break;
|
|
}
|