diff -u bbswitch-0.8-14.mga9.org/bbswitch.c bbswitch-0.8-14.mga9/bbswitch.c --- bbswitch-0.8-14.mga9.org/bbswitch.c 2022-03-21 09:40:42.000000000 +0100 +++ bbswitch-0.8-14.mga9/bbswitch.c 2022-08-08 16:58:06.445958382 +0200 @@ -264,10 +264,15 @@ pci_disable_device(dis_dev); do { struct acpi_device *ad = NULL; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + ad = acpi_fetch_acpi_dev(dis_handle); + if (!ad) { +#else int r; r = acpi_bus_get_device(dis_handle, &ad); if (r || !ad) { +#endif pr_warn("Cannot get ACPI device for PCI device\n"); break; }