aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-kernel/sllin/files/0005-Fix-build-with-5.13-kernel.patch24
-rw-r--r--recipes-kernel/sllin/files/0006-Fix-build-with-5.14-kernel.patch108
-rw-r--r--recipes-kernel/sllin/sllin.bb2
3 files changed, 134 insertions, 0 deletions
diff --git a/recipes-kernel/sllin/files/0005-Fix-build-with-5.13-kernel.patch b/recipes-kernel/sllin/files/0005-Fix-build-with-5.13-kernel.patch
new file mode 100644
index 000000000..511470810
--- /dev/null
+++ b/recipes-kernel/sllin/files/0005-Fix-build-with-5.13-kernel.patch
@@ -0,0 +1,24 @@
+Remove TTY_LDISC_MAGIC usage
+
+The 5.13 kernel removed the .magic field from tty_ldisc_ops and
+the associated TTY_LDISC_MAGIC #define, so remove their use when
+building for 5.13 or newer.
+
+Upstream-Status: Inappropriate [no upstream]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+diff --git a/sllin/sllin.c b/sllin/sllin.c
+index 92c52ad..904cff9 100644
+--- a/sllin/sllin.c
++++ b/sllin/sllin.c
+@@ -1619,7 +1619,9 @@ static int sllin_ioctl(struct tty_struct *tty, struct file *file,
+
+ static struct tty_ldisc_ops sll_ldisc = {
+ .owner = THIS_MODULE,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
+ .magic = TTY_LDISC_MAGIC,
++#endif
+ .name = "sllin",
+ .open = sllin_open,
+ .close = sllin_close,
diff --git a/recipes-kernel/sllin/files/0006-Fix-build-with-5.14-kernel.patch b/recipes-kernel/sllin/files/0006-Fix-build-with-5.14-kernel.patch
new file mode 100644
index 000000000..bb0049f09
--- /dev/null
+++ b/recipes-kernel/sllin/files/0006-Fix-build-with-5.14-kernel.patch
@@ -0,0 +1,108 @@
+Updates for 5.14
+
+The 5.14 kernel reworked the tty register and unregister call
+arguments, and made one of the arguments to the receive_buf
+callback const, add some kernel version conditionals to handle
+those.
+
+Upstream-Status: Inappropriate [no upstream]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ sllin/sllin.c | 29 ++++++++++++++++++++++++-----
+ 1 file changed, 24 insertions(+), 5 deletions(-)
+
+diff --git a/sllin/sllin.c b/sllin/sllin.c
+index 904cff9..b89d06d 100644
+--- a/sllin/sllin.c
++++ b/sllin/sllin.c
+@@ -72,6 +72,12 @@
+ #include <linux/version.h>
+ #include "linux/lin_bus.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++#define FP_CONST const
++#else
++#define FP_CONST
++#endif
++
+ /* Should be in include/linux/tty.h */
+ #define N_SLLIN 25
+ /* -------------------------------- */
+@@ -185,9 +191,9 @@ struct sllin {
+ static struct net_device **sllin_devs;
+ static int sllin_configure_frame_cache(struct sllin *sl, struct can_frame *cf);
+ static void sllin_slave_receive_buf(struct tty_struct *tty,
+- const unsigned char *cp, char *fp, int count);
++ const unsigned char *cp, FP_CONST char *fp, int count);
+ static void sllin_master_receive_buf(struct tty_struct *tty,
+- const unsigned char *cp, char *fp, int count);
++ const unsigned char *cp, FP_CONST char *fp, int count);
+
+
+ /* Values of two parity bits in LIN Protected
+@@ -492,7 +498,7 @@ static void sll_setup(struct net_device *dev)
+ Routines looking at TTY side.
+ ******************************************/
+ static void sllin_master_receive_buf(struct tty_struct *tty,
+- const unsigned char *cp, char *fp, int count)
++ const unsigned char *cp, FP_CONST char *fp, int count)
+ {
+ struct sllin *sl = (struct sllin *) tty->disc_data;
+
+@@ -735,7 +741,7 @@ static void sllin_slave_finish_rx_msg(struct sllin *sl)
+ }
+
+ static void sllin_slave_receive_buf(struct tty_struct *tty,
+- const unsigned char *cp, char *fp, int count)
++ const unsigned char *cp, FP_CONST char *fp, int count)
+ {
+ struct sllin *sl = (struct sllin *) tty->disc_data;
+ int lin_id;
+@@ -842,7 +848,7 @@ static void sllin_slave_receive_buf(struct tty_struct *tty,
+ }
+
+ static void sllin_receive_buf(struct tty_struct *tty,
+- const unsigned char *cp, char *fp, int count)
++ const unsigned char *cp, FP_CONST char *fp, int count)
+ {
+ struct sllin *sl = (struct sllin *) tty->disc_data;
+ netdev_dbg(sl->dev, "sllin_receive_buf invoked, count = %u\n", count);
+@@ -1619,6 +1625,9 @@ static int sllin_ioctl(struct tty_struct *tty, struct file *file,
+
+ static struct tty_ldisc_ops sll_ldisc = {
+ .owner = THIS_MODULE,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ .num = N_SLLIN,
++#endif
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
+ .magic = TTY_LDISC_MAGIC,
+ #endif
+@@ -1648,7 +1657,11 @@ static int __init sllin_init(void)
+ }
+
+ /* Fill in our line protocol discipline, and register it */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ status = tty_register_ldisc(&sll_ldisc);
++#else
+ status = tty_register_ldisc(N_SLLIN, &sll_ldisc);
++#endif
+ if (status) {
+ pr_err("sllin: can't register line discipline\n");
+ kfree(sllin_devs);
+@@ -1719,9 +1732,15 @@ static void __exit sllin_exit(void)
+ kfree(sllin_devs);
+ sllin_devs = NULL;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ tty_unregister_ldisc(&sll_ldisc);
++
++#else
+ i = tty_unregister_ldisc(N_SLLIN);
++
+ if (i)
+ pr_err("sllin: can't unregister ldisc (err %d)\n", i);
++#endif
+ }
+
+ module_init(sllin_init);
diff --git a/recipes-kernel/sllin/sllin.bb b/recipes-kernel/sllin/sllin.bb
index 70d1a9311..a64b0f919 100644
--- a/recipes-kernel/sllin/sllin.bb
+++ b/recipes-kernel/sllin/sllin.bb
@@ -18,6 +18,8 @@ SRC_URI:append = " \
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://0005-Fix-build-with-5.13-kernel.patch;pnum=2 \
+ file://0006-Fix-build-with-5.14-kernel.patch;pnum=2 \
file://sllin-demo.service \
file://start_lin_demo.sh \
file://lin_config.conf \