All of lore.kernel.org
 help / color / mirror / Atom feed
* any hint?
@ 2014-09-16  1:04 hdarwin
  2014-09-16  1:24 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: hdarwin @ 2014-09-16  1:04 UTC (permalink / raw)
  To: kernelnewbies

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* any hint?
  2014-09-16  1:04 any hint? hdarwin
@ 2014-09-16  1:24 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2014-09-16  1:24 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Sep 16, 2014 at 10:04:27AM +0900, hdarwin wrote:
> 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.

The challenge system is correct, please do your own work, otherwise,
it's not much of a challenge, is it?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-16  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-16  1:04 any hint? hdarwin
2014-09-16  1:24 ` Greg KH

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.