[crux-commits] ports/contrib (3.6): bbswitch: added patch for building with 5.6+ kernels

crux at crux.nu crux at crux.nu
Tue Apr 20 22:17:42 UTC 2021


commit 6345a0d489ed153de3d93df0d684a9dc7776294d
Author: Matt Housh <jaeger at crux.ninja>
Date:   Tue Apr 20 17:17:25 2021 -0500

    bbswitch: added patch for building with 5.6+ kernels

diff --git a/bbswitch/.signature b/bbswitch/.signature
index d5619f3ac..16158fbc3 100644
--- a/bbswitch/.signature
+++ b/bbswitch/.signature
@@ -1,5 +1,6 @@
 untrusted comment: verify with /etc/ports/contrib.pub
-RWSagIOpLGJF354zgq4Ux9UdvI4YGfOkfO28NG4+ENVzXeBr4LZklDqVif/uThPdT+26QwgIbu1AzYhX/09b6LhetZo9NBHTIQw=
-SHA256 (Pkgfile) = 7b8e1e8a4306ffe6833f26441d837049f383c3309498021ec718e6f2674fb141
+RWSagIOpLGJF3zYGAiVq30QZf30MYKBSIoXE0Ungkz0oIB1iETvK+9LSASdbiXh3OYISpMuoL5UI/s3zF+DjY8UpOyy4wtde+AQ=
+SHA256 (Pkgfile) = 1a37df0336abd78e096b5eafbef3df0c515d7a4ae4e070ff1bd1a42327b1e721
 SHA256 (.footprint) = 7440253c3fd2b9481f105ccb7585cab877c98be6b285c733695bdd6b51cbd459
 SHA256 (bbswitch-0.8.tar.gz) = 76cabd3f734fb4fe6ebfe3ec9814138d0d6f47d47238521ecbd6a986b60d1477
+SHA256 (bbswitch-kernel56.patch) = 29e3cc5b4f11c6760c99e385d04e3065414eaab36a7661cb3af8f093643498b4
diff --git a/bbswitch/Pkgfile b/bbswitch/Pkgfile
index 7497c058b..986dde14f 100644
--- a/bbswitch/Pkgfile
+++ b/bbswitch/Pkgfile
@@ -5,10 +5,12 @@
 name=bbswitch
 version=0.8
 release=1
-source=(https://github.com/Bumblebee-Project/$name/archive/v$version/$name-$version.tar.gz)
+source=(https://github.com/Bumblebee-Project/$name/archive/v$version/$name-$version.tar.gz \
+	$name-kernel56.patch)
 
 build() {
 	cd $name-$version
+	patch -p1 -i $SRC/$name-kernel56.patch
 	make
 	install -D -m 0644 $name.ko $PKG/lib/modules/$(uname -r)/misc/$name.ko
 }
diff --git a/bbswitch/bbswitch-kernel56.patch b/bbswitch/bbswitch-kernel56.patch
new file mode 100644
index 000000000..9271d6e2e
--- /dev/null
+++ b/bbswitch/bbswitch-kernel56.patch
@@ -0,0 +1,38 @@
+diff -up bbswitch-0.8/bbswitch.c.5.6fix bbswitch-0.8/bbswitch.c
+--- bbswitch-0.8/bbswitch.c.5.6fix      2020-04-27 21:03:31.374417071 -0400
++++ bbswitch-0.8/bbswitch.c     2020-04-28 20:10:56.479080120 -0400
+@@ -35,6 +35,10 @@
+ #include <linux/suspend.h>
+ #include <linux/seq_file.h>
+ #include <linux/pm_runtime.h>
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++#include <linux/proc_fs.h>
++#endif
+ 
+ #define BBSWITCH_VERSION "0.8"
+ 
+@@ -375,6 +379,15 @@ static int bbswitch_pm_handler(struct no
+     return 0;
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static struct proc_ops bbswitch_fops = {
++    .proc_open   = bbswitch_proc_open,
++    .proc_read   = seq_read,
++    .proc_write  = bbswitch_proc_write,
++    .proc_lseek = seq_lseek,
++    .proc_release= single_release
++};
++#else
+ static struct file_operations bbswitch_fops = {
+     .open   = bbswitch_proc_open,
+     .read   = seq_read,
+@@ -382,6 +395,7 @@ static struct file_operations bbswitch_f
+     .llseek = seq_lseek,
+     .release= single_release
+ };
++#endif
+ 
+ static struct notifier_block nb = {
+     .notifier_call = &bbswitch_pm_handler


More information about the crux-commits mailing list