Commit Graph

11 Commits

Author SHA1 Message Date
Chih-En Lin
b9b37fc39f kbleds: Replace magic with driver_name
Since the commit 5052df99d3bc ("tty: remove TTY_DRIVER_MAGIC") [1],
the magic field no longer exists in the tty_driver. Instead of
printing the magic field, use the driver_name field.

[1] https://lore.kernel.org/linux-doc/20220907231109.htnfxzmr6wkuhn2v@tarta.nabijaczleweli.xyz/

Close #216
Close #217
2023-08-10 08:56:19 +08:00
linD026
6b6b6635cf
CI: Introduce Smatch for static analysis (#125)
Smatch[1][2] is a pluggable static analysis for C. It may help us find
out the potential problem of the example code.

Doing with smatch, if set the --file-output flag, it will generate the
{}.c.smatch report for each c file. This will make a little bit
complicated to collect all the report messages. So, here we stay at the
default setting, stdout for the smatch messages.

For more information, see:
- https://lwn.net/Articles/696624/
- https://elinux.org/images/d/d3/Bargmann.pdf

Also, fix the warning from Smatch:

Smatch failed: 1 warning(s), 1 error(s)
lkmpg/examples/procfs2.c:57 procfile_write() error: buffer overflow 'procfs_buffer' 1024 <= 1024
lkmpg/examples/kbleds.c:58 kbleds_init() warn: argument 5 to %lx specifier is cast from pointer

Furthermore, the effect of the write operation in procfs2.c is too
implied. So after writing, print the buffer every time.

Close #122

[1] https://github.com/error27/smatch
[2] https://repo.or.cz/w/smatch.git
2021-11-01 08:20:41 +08:00
linD026
62dbb1b7b8
Adapt the timer API Usage (#98)
Since v4.14 [1], the timer API has been changed to improve memory safety.
The series of improvements ended up at v4.15 [2].

Reference: https://lwn.net/Articles/735887/

Close #97

[1] 686fef928b
[2] 841b86f328
2021-09-10 12:29:48 +08:00
linD026
9289bfe59c
Fix the warnings raised by Sparse (#92)
Sparse[1] is a semantic parser, capable of finding out the potential
problems of Linux kernel code. This patch fixed the warnings.

[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-04 17:53:29 +08:00
linD026
eef2bc4395
Enforce Linux kernel coding style (#88)
The only exception is to indent with four spaces rather than tabs
for sticking to compact layout of source listing.

Close #87
2021-09-02 15:15:07 +08:00
gagachang
9827e32e4d Update some file path to kernel v5.x+ in example/kbleds.c
1. drivers/char/vt_ioctl.c -> drivers/tty/vt/vt_ioctl.c
2. drivers/char/keyboard.c -> drivers/tty/vt/keyboard.c
2021-08-21 14:51:37 +08:00
Jim Huang
10c7a9433a Apply editorial changes
This patch makes source listing shorter and more compact, that helps
when browsing.
2021-08-08 01:24:59 +08:00
Jim Huang
760bbe70cb Drop duplicated module author information 2021-07-22 07:29:07 +08:00
Jim Huang
64f791f274 Improve the compatibility with kernel version < 5.6 2021-07-22 07:17:31 +08:00
Jim Huang
50b8dfe6c2 Enforce the customized style for example code
Instead of using tab for indention, the style defaults to 4 spaces for
the sake of compact layout.
2021-07-22 06:58:13 +08:00
Jim Huang
2246e20809 Add LaTeX script and sample code 2021-07-22 06:35:24 +08:00