linamh/app-emulation/opencbm/files/0.4.99.99a/002_opencbm-0.4.99.99a-cbm_module.patch
2021-06-30 18:45:43 +02:00

59 lines
2.1 KiB
Diff

From 32a19cb166f6913dcf9885284bf36082f39b350a Mon Sep 17 00:00:00 2001
From: Spiro Trikaliotis <spiro.trikaliotis@gmx.de>
Date: Sat, 12 Oct 2019 20:37:30 +0200
Subject: [PATCH] Fix compiler error on kernel module compilation
Before, we tried to determine with HAVE_LINUX_SCHED_SIGNAL_H if we need
to include <linux/sched/signal.h>. Unfortunately, the mechanism was not
robust.
So, reworked it and hardcoded it depending on the kernel version (>=
4.11.0). This fixes #22.
---
opencbm/LINUX/config.make | 3 +--
opencbm/sys/linux/cbm_module.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/opencbm/LINUX/config.make b/opencbm/LINUX/config.make
index 7e05f33b..30d42d2c 100644
--- a/opencbm/LINUX/config.make
+++ b/opencbm/LINUX/config.make
@@ -107,7 +107,6 @@ KERNEL_SOURCE = ${shell for d in /lib/modules/`uname -r`/build /usr/src/linux; d
ifneq ($(strip $(KERNEL_SOURCE)),)
HAVE_KERNEL_SOURCE=-DHAVE_KERNEL_SOURCE=1
KERNEL_INCLUDE_CONFIG = ${shell for c in ${KERNEL_SOURCE}/include/linux/autoconf.h ${KERNEL_SOURCE}/include/linux/config.h; do test -f $$c && echo $$c; done | head -n 1}
- KERNEL_HAVE_LINUX_SCHED_SIGNAL_H = ${shell test -e ${KERNEL_SOURCE}/include/linux/sched/signal.h && echo -DHAVE_LINUX_SCHED_SIGNAL_H=1}
endif
HAVE_LIBUSB0 = ${shell pkg-config libusb && echo 1}
@@ -137,7 +136,7 @@ endif
# XE1541-like cable. Don't to it. Upgrade to XM1541 instead.
#
#KERNEL_FLAGS = -DDIRECT_PORT_ACCESS
-KERNEL_FLAGS = "${KERNEL_DEFINE} ${KERNEL_HAVE_LINUX_SCHED_SIGNAL_H}"
+KERNEL_FLAGS = "${KERNEL_DEFINE}"
endif
#
diff --git a/opencbm/sys/linux/cbm_module.c b/opencbm/sys/linux/cbm_module.c
index 94456015..dba88511 100644
--- a/opencbm/sys/linux/cbm_module.c
+++ b/opencbm/sys/linux/cbm_module.c
@@ -32,7 +32,6 @@
#include <linux/kernel.h>
#include <linux/slab.h>
-
/*
* Starting with 2.3.10, the IRQ and bi-directional bits are uncoupled from
* the control byte.
@@ -54,7 +53,7 @@
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/sched.h>
-#ifdef HAVE_LINUX_SCHED_SIGNAL_H
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#endif
#include <linux/uaccess.h>