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

sllin module does not compile with Linux kernel >= 4.11.9 #2

Closed knezicm closed 3 years ago

knezicm commented 6 years ago

Due to the change in net_device structure in Linux kernel >= 4.11.9, sllin module does not compile ('destructor' field cannot be found). I applied a patch described in https://patchwork.kernel.org/patch/9826595/. However, now the reported errors are:

/home/pi/linux-lin/sllin/sllin.c: In function ‘sllin_kwthread’: /home/pi/linux-lin/sllin/sllin.c:1175:2: error: unknown type name ‘sched_param’ sched_param schparam = { .sched_priority = 40 }; ^~~

home/pi/linux-lin/sllin/sllin.c:1175:27: error: field name not in record or union initializer sched_param schparam = { .sched_priority = 40 }; ^

/home/pi/linux-lin/sllin/sllin.c:1183:42: error: passing argument 3 of ‘sched_setscheduler’ from incompatible pointer type [-Werror=incompatible-pointer-types] sched_setscheduler(current, SCHED_FIFO, &schparam); ^

knezicm commented 6 years ago

It seems that in recent Linux kernels (I am not sure from which version), struct sched_param has been moved from linux/sched.h to uapi/linux/sched/types.h, so that include part has to be updated in sllin.c accordingly.

Also, note that line discipline 25 is reserved for NFC NCI UART in recent kernel versions.

knezicm commented 6 years ago

Here is the patch for the aforementioned changes. recent-kernels-workaround.patch.txt

ppisa commented 3 years ago

Thanks for the report. It would be great if the changes use LINUX_VERSION_CODE to allow compilation even for older kernels. I would keep at least 4.4 support still available to support Civil Infrastructure Platform supported LTS kernels. In the fact above mentioned problems seems to be solved in sl-lin "mainline"/repo of one of initial authors in 2019

https://github.com/ppisa/linux-lin/commit/74347c360f6765e7c1ddaa1d08dfe8354610261c

It is little unfortunate that we have used GIT repo outside GitHub then I have found that trainman419 setup repo on GitHub without notice to us and it has been forked by many other people. Because our mainline has not been followed, I have created own fork of this repo on GitHub to at least point users to the progress by Insight Networking. So, please check state in my repo https://github.com/ppisa/linux-lin which I try to maintain, mostly in spare time, I have no actual LIN project now.

As for the line discipline collision, we need to register that into mainline and even push the project into mainline. But it depends on the some statistics and reports that our project is really in use which would backup mainlining.

trainman419 commented 3 years ago

@ppisa oh hai.

Yes, I set up a mirror on github because it seemed the original project was stalled and I had to make some changes to get it to compile. It's actually been kind of annoying to have people forking and reporting bugs against a repo that I just have a mirror.

I'd be happy to transfer ownership of this repo to you if you'd like.

ppisa commented 3 years ago

Thanks for the response. I propose to unite forces and guide all users and people willing to contribute to the single place https://github.com/lin-bus . I move my wiki there as well https://github.com/ppisa/linux-lin/wiki . More thoughts in #4

ppisa commented 3 years ago

The changes based on my branch and kbader94 followup work and testing for 5.10.17 kernel committed to mainline.