add assignement 00 to 08
This commit is contained in:
29
03/main.c
Normal file
29
03/main.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("42");
|
||||
MODULE_DESCRIPTION("A module that does work");
|
||||
|
||||
|
||||
static int do_work(int *nbLoop)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < *nbLoop; ++x) {
|
||||
udelay(10);
|
||||
}
|
||||
if (*nbLoop > 10)
|
||||
pr_info("do_work(): slept a long time\n");
|
||||
return(x * *nbLoop);
|
||||
}
|
||||
|
||||
static int __init module_example_42_init(void)
|
||||
{
|
||||
int x = 10;
|
||||
x = do_work(&x);
|
||||
return x;
|
||||
}
|
||||
|
||||
module_init(module_example_42_init);
|
Reference in New Issue
Block a user