lin-bus / linux-lin

Linux kernel LIN bus support implemented as TTY line discipline for generic UART conrollers, documentation https://github.com/lin-bus/linux-lin/wiki, based on https://github.com/lin-bus/linux-lin/wiki/sllin-rtlws14-paper.pdf, more CAN related projects http://canbus.pages.fel.cvut.cz/
https://github.com/lin-bus/linux-lin/wiki
38 stars 26 forks source link

Linux6 #22

Closed CherineK closed 1 year ago

CherineK commented 1 year ago

Hi,

There have been minor changes in Linux 5.16 and 5.17 breaking the build. Description is here: tty_mode_ioctl: https://elixir.bootlin.com/linux/v5.16.20/source/include/linux/tty.h hangup: https://elixir.bootlin.com/linux/v5.17.15/source/include/linux/tty_ldisc.h

I have tested the modifications on Linux 5.19 (Ubuntu 22.04 LTS) and the module works fine. It also builds on Linux 6.2, but I could not fully test the module there.

Since older kernels are still maintained, the modifications I made are included between #if KERNEL_VERSION_CODE / #endif directives.

Best regards, CK

ppisa commented 1 year ago

Thanks for testing and contribution.

I have tested that updated version builds build against 4.19.xx, 6.1.xx and 6.3.0-rt11. I merge change and if the problem is noticed I will be happy when it is reported and investigated.

I have noticed another potential problem for latest kernels with __initdata. If you encounter it as well, we can delete that modifier.

diff --git a/sllin/sllin.c b/sllin/sllin.c
index 09884b5..5a5af0e 100644
--- a/sllin/sllin.c
+++ b/sllin/sllin.c
@@ -96,7 +96,7 @@ MODULE_PARM_DESC(led_delay,
                  "blink delay time for activity leds (msecs, default: 50).");
 #endif /* SLLIN_LED_TRIGGER */

-static __initdata const char banner[] =
+static const char banner[] =
        KERN_INFO "sllin: serial line LIN interface driver\n";

 MODULE_ALIAS_LDISC(N_SLLIN);
CherineK commented 1 year ago

I also have the __initdata issue on Linux 6.2 (Arch Linux) but not on Linux 5.19 (Ubuntu 22.04). The patch you are suggesting is exactly the one I am using.

Actually, I was not entirely sure if this error was due to my setup and since I could not pinpoint the exact change in the kernel that caused it, I was waiting to test a bit more before reporting it.

ppisa commented 1 year ago

OK, I am removing __initdata location specification. Less than 40 bytes save by release after initialization does not worth the troubles.