Skip to content

Commit c93bd00

Browse files
committed
fixed up this repo
1 parent 85a5b42 commit c93bd00

File tree

4 files changed

+49
-48
lines changed

4 files changed

+49
-48
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
*.mod.c
44
*.mod.o
55
*.o
6+
*.o.cmd
7+
68
.tmp_versions/
79
modules.order
810
Module.symvers
9-
*.o.cmd
10-
flags.cfg
11+
12+
/flags.cfg
13+
/*.stamp

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ KDIR:=/lib/modules/$(KVER)/build
1919
V:=0
2020
# do you want to use checkpatch?
2121
DO_CHECKPATCH:=1
22-
# root of a real kernel folder so we could run checkpatch.pl
23-
KROOT:=~/install/linux-source-3.11.0
2422
# flags file
2523
FLAGS:=flags.cfg
2624
# all targets will depend on this
@@ -71,10 +69,7 @@ $(FLAGS): scripts/process_flags.py $(ALL_DEP)
7169

7270
checkpatch.stamp: $(C_SOURCES)
7371
$(info doing [$@])
74-
$(Q)wrapper_silent $(KDIR)/scripts/checkpatch.pl --file top.c --root $(KROOT)
75-
$(Q)wrapper_silent $(KDIR)/scripts/checkpatch.pl --file ser_empty.c --root $(KROOT)
76-
$(Q)wrapper_silent $(KDIR)/scripts/checkpatch.pl --file ser_mem.c --root $(KROOT)
77-
$(Q)wrapper_silent $(KDIR)/scripts/checkpatch.pl --file ser_print.c --root $(KROOT)
72+
$(Q)$(KDIR)/scripts/checkpatch.pl --file $(C_SOURCES) --no-tree > /dev/null 2> /dev/null
7873
$(Q)touch $@
7974

8075
.PHONY: modules_install

ser_mem.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,47 @@
1717
#include "kernel_helper.h"
1818

1919
/* do you want memory debuggin ? (collecting number of allocations
20-
* and deallocations...). */
20+
* and deallocations...).
21+
*/
2122
/* #define DO_MEMDBG */
2223

2324
/*
24-
memory handling code
25-
*/
25+
* memory handling code
26+
*/
2627

2728
/*
28-
Get the page size for the operating system currently running...
29-
*/
29+
* Get the page size for the operating system currently running...
30+
*/
3031
unsigned int service_get_page_size(void)
3132
{
3233
return PAGE_SIZE;
3334
}
3435
/*
35-
Translate a virtual address to a physical one
36-
*/
36+
* Translate a virtual address to a physical one
37+
*/
3738
unsigned long service_virt_to_phys(void *virt)
3839
{
3940
/* TODO: should we add error checking here ?!? */
4041
return virt_to_phys(virt);
4142
}
4243
/*
43-
put 0 in an area of memory...
44-
*/
44+
* put 0 in an area of memory...
45+
*/
4546
void service_zeromem(void *addr, unsigned int size)
4647
{
4748
/* TODO: is there a faster way to do it? */
4849
memset(addr, 0, size);
4950
}
5051
/*
51-
put a certain number in an area of memory
52-
*/
52+
* put a certain number in an area of memory
53+
*/
5354
void service_memset(void *addr, int c, unsigned int size)
5455
{
5556
memset(addr, c, size);
5657
}
5758
/*
58-
Memory copy API
59-
*/
59+
*Memory copy API
60+
*/
6061
void service_memcpy(const void *to, const void *from, unsigned int size)
6162
{
6263
memcpy((void *)to, from, size);
@@ -67,21 +68,22 @@ static unsigned int malloc_num;
6768
static unsigned int free_num;
6869
#endif /* DO_MEMDBG */
6970
/*
70-
Memory allocation API
71-
*/
71+
* Memory allocation API
72+
*/
7273
void *service_malloc(unsigned int size)
7374
{
7475
void *p;
76+
7577
DEBUG("start");
7678
#ifdef DO_MEMDBG
7779
malloc_num++;
7880
#endif /* DO_MEMDBG */
7981
/*
80-
if (size == 0) {
81-
DEBUG("kmalloc size=0");
82-
BUG();
83-
}
84-
p = kmalloc(size, GFP_KERNEL);
82+
* if (size == 0) {
83+
* DEBUG("kmalloc size=0");
84+
* BUG();
85+
* }
86+
* p = kmalloc(size, GFP_KERNEL);
8587
*/
8688
p = kmalloc(size, GFP_KERNEL);
8789
DEBUG("kmalloc size=%d pointer=%p", size, p);
@@ -90,8 +92,8 @@ void *service_malloc(unsigned int size)
9092
return p;
9193
}
9294
/*
93-
Memory relase API
94-
*/
95+
* Memory relase API
96+
*/
9597
void service_free(void *pointer)
9698
{
9799
DEBUG("start");

ser_print.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,59 +17,60 @@
1717
#include "kernel_helper.h"
1818

1919
/*
20-
Module name function
21-
*/
20+
* Module name function
21+
*/
2222
const char *service_modname(void)
2323
{
2424
return myname;
2525
}
2626

2727
/*
28-
Throw a bug
29-
*/
28+
* Throw a bug
29+
*/
3030
void service_bug(void)
3131
{
3232
BUG();
3333
}
3434

3535
/*
36-
A printing function. This function supports var args.
37-
*/
36+
* A printing function. This function supports var args.
37+
*/
3838
int service_printk(const char *fmt, ...)
3939
{
4040
va_list args;
4141
int ret;
42+
4243
va_start(args, fmt);
4344
ret = vprintk(fmt, args);
4445
va_end(args);
4546
return ret;
4647
}
4748
/*
48-
A var arg printk version
49-
*/
49+
* A var arg printk version
50+
*/
5051
int service_vprintk(const char *fmt, va_list list)
5152
{
5253
return vprintk(fmt, list);
5354
}
5455

5556
/*
56-
A simple string printing function
57-
*/
57+
* A simple string printing function
58+
*/
5859
int service_puts(const char *str)
5960
{
6061
return pr_info("%s", str);
6162
}
6263

6364
/*
64-
A stack trace service
65-
*/
65+
* A stack trace service
66+
*/
6667
void service_stacktrace(void)
6768
{
6869
/*
69-
#ifdef CONFIG_STACKTRACE
70-
struct stack_trace my_trace;
71-
save_stack_trace(&my_trace);
72-
print_stack_trace(&my_trace,0);
73-
#endif // CONFIG_STACKTRACE
74-
*/
70+
* #ifdef CONFIG_STACKTRACE
71+
* struct stack_trace my_trace;
72+
* save_stack_trace(&my_trace);
73+
* print_stack_trace(&my_trace,0);
74+
* #endif // CONFIG_STACKTRACE
75+
*/
7576
}

0 commit comments

Comments
 (0)