From: hdarwin89@gmail.com (hdarwin)
To: kernelnewbies@lists.kernelnewbies.org
Subject: any hint?
Date: Tue, 16 Sep 2014 10:04:27 +0900 [thread overview]
Message-ID: <00c201cfd14a$2c01bc10$84053430$@gmail.com> (raw)
Hi there.
I'm playing kernel module development challenge.
I read http://lxr.free-electrons.com/source/Documentation/CodingStyle and
learn how to write right code.
I am sure that there's no coding style error in following files.
But challenge system say that there are coding style error.
Any hint for me?
Ps: I tried to submit answer without meaningless comment. but It's not
correct.
File1.c
> #include <linux/module.h>
> #include <linux/kernel.h>
>
> int hello(void)
> {
> printk(KERN_DEBUG "Hello World!\n");
> return 0;
> }
>
> module_init(hello);
> MODULE_LICENSE("GPL");
File2.c
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <asm/delay.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 */
> printk("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)
> {
> return;
> }
>
> module_init(my_init);
> module_exit(my_exit);
next reply other threads:[~2014-09-16 1:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 1:04 hdarwin [this message]
2014-09-16 1:24 ` any hint? Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00c201cfd14a$2c01bc10$84053430$@gmail.com' \
--to=hdarwin89@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.