aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/04/coding_style.c
blob: cebe4e54b994efa086a87924ee0f849a4f1f9d15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
int do_work(int *my_int, int retval)
{
	int x;
	int y = *my_int;
	int z;

	for(x = 0 ; x < *my_int ; ++x)
		udelay(10);
	if (y < 10)
		/* That was a long sleep, tell userspace about it. */
		pr_debug("We slept a long time!");
	z = x * y;

	return z;
}

int my_init(void)
{
	int x = 10;

	x = do_work(&x, x);

	return x;
}

void my_exit(void)
{
}

module_init(my_init);
module_exit(my_exit);