commit:     3dd7021076f7c2c94af6ba4311a424beed56c005
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 21:22:23 2022 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Fri May 27 21:23:53 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3dd70210

sys-power/bbswitch: Fix compat with kernel 5.18

Closes: https://bugs.gentoo.org/847481
Thanks-to: Joe Kappus
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 sys-power/bbswitch/bbswitch-0.8_p20211129.ebuild    |  4 +++-
 sys-power/bbswitch/files/bbswitch-kernel-5.18.patch | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/sys-power/bbswitch/bbswitch-0.8_p20211129.ebuild 
b/sys-power/bbswitch/bbswitch-0.8_p20211129.ebuild
index 63147964328f..2aa21af88733 100644
--- a/sys-power/bbswitch/bbswitch-0.8_p20211129.ebuild
+++ b/sys-power/bbswitch/bbswitch-0.8_p20211129.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit linux-mod toolchain-funcs
 
@@ -31,6 +31,8 @@ RDEPEND=""
 
 MODULE_NAMES="bbswitch(acpi)"
 
+PATCHES=( "${FILESDIR}/${PN}-kernel-5.18.patch" )
+
 pkg_setup() {
        linux-mod_pkg_setup
 

diff --git a/sys-power/bbswitch/files/bbswitch-kernel-5.18.patch 
b/sys-power/bbswitch/files/bbswitch-kernel-5.18.patch
new file mode 100644
index 000000000000..07cecd4cdf41
--- /dev/null
+++ b/sys-power/bbswitch/files/bbswitch-kernel-5.18.patch
@@ -0,0 +1,19 @@
+diff -u -r bbswitch-0.8/bbswitch.c bbswitch-0.8-5.18/bbswitch.c
+--- bbswitch-0.8/bbswitch.c    2022-05-24 20:26:22.184553495 +0000
++++ bbswitch-0.8-5.18/bbswitch.c       2022-05-24 20:29:00.797008130 +0000
+@@ -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;
+         }

Reply via email to