corrections on 03 and 08, 09 done

This commit is contained in:
2025-07-11 19:35:43 +02:00
parent fb12152966
commit 2e4d67d510
5 changed files with 115 additions and 18 deletions

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
@ -7,21 +8,21 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("42");
MODULE_DESCRIPTION("A module that does work");
static int do_work(int *nbLoop)
static int do_work(int *nb_loop)
{
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);
for (x = 0; x < *nb_loop; ++x)
usleep_range(10);
if (*nb_loop > 10)
pr_info("%s: slept a long time\n", __func__);
return(x * *nb_loop);
}
static int __init module_example_42_init(void)
{
int x = 10;
x = do_work(&x);
return x;
}