From 05a4f8c51b2ed6a23e60e4cc6b1a6975a75a39a0 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 25 Feb 2021 16:02:40 -0500 Subject: sllin: add patch to enable building against newer kernels Add patch to enable building the sllin driver against kernels 5.9 or newer. Bug-AGL: SPEC-3819 Signed-off-by: Scott Murray Change-Id: Icb99773833a79f47af3e3287e6c62d64bb344f25 --- .../files/0004-Fix-build-with-5.9-kernel.patch | 48 ++++++++++++++++++++++ recipes-kernel/sllin/sllin.bb | 1 + 2 files changed, 49 insertions(+) create mode 100644 recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch diff --git a/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch b/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch new file mode 100644 index 000000000..f3bcda9fe --- /dev/null +++ b/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch @@ -0,0 +1,48 @@ +Use sched_set_fifo on newer kernels + +The 5.9 kernel removed the export of sched_setscheduler, use +the new sched_set_fifo API if building on 5.9 or newer. There +is a slight difference in resulting priority level, the new +API will yield a priority of 50 instead of the explicit value +of 40 being used with sched_setscheduler, but this should not +be an issue. + +Upstream-Status: Inappropriate [no upstream] +Signed-off-by: Scott Murray + +--- +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 133d6e9..92c52ad 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -1059,14 +1059,20 @@ static int sllin_kwthread(void *ptr) + { + struct sllin *sl = (struct sllin *)ptr; + struct tty_struct *tty = sl->tty; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + struct sched_param schparam = { .sched_priority = 40 }; ++#endif + int tx_bytes = 0; /* Used for Network statistics */ + unsigned long flags; + int lin_id; + struct sllin_conf_entry *sce; + + netdev_dbg(sl->dev, "sllin_kwthread started.\n"); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + sched_setscheduler(current, SCHED_FIFO, &schparam); ++#else ++ sched_set_fifo(current); ++#endif + + clear_bit(SLF_ERROR, &sl->flags); + sltty_change_speed(tty, sl->lin_baud); +@@ -1274,8 +1280,8 @@ slstate_response_wait: + sl->lin_state = SLSTATE_RESPONSE_WAIT_BUS; + } + } ++ fallthrough; + +- /* Be aware, no BREAK here */ + case SLSTATE_RESPONSE_WAIT_BUS: + if (sl->rx_cnt < sl->rx_expect) + continue; diff --git a/recipes-kernel/sllin/sllin.bb b/recipes-kernel/sllin/sllin.bb index 0478b21a7..f469ecee1 100644 --- a/recipes-kernel/sllin/sllin.bb +++ b/recipes-kernel/sllin/sllin.bb @@ -17,6 +17,7 @@ SRC_URI_append = " \ file://0002_fix_null_operation_check.patch;pnum=2 \ file://0003-Allow-recent-kernels-newer-4.11.x-to-build.patch;pnum=2 \ file://0001-Disable-sllin-driver-debug-log.patch;pnum=2 \ + file://0004-Fix-build-with-5.9-kernel.patch;pnum=2 \ file://sllin-demo.service \ file://start_lin_demo.sh \ file://lin_config.conf \ -- cgit 1.2.3-korg