From: Thadeu Lima de Souza Cascardo Date: Sun, 6 Dec 2009 00:39:24 +0000 (-0200) Subject: Use a macro for the configured message subject. X-Git-Tag: v1.2.0 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fkernel%2Fsamples%2F01.hello%2F.git;a=commitdiff_plain;h=3559c37d96b467dbd5abd5e9e6695e2fccb7958f Use a macro for the configured message subject. --- diff --git a/hello.c b/hello.c index 25c722d..772a1e3 100644 --- a/hello.c +++ b/hello.c @@ -4,11 +4,15 @@ /* Should be declared to not taint the kernel. */ MODULE_LICENSE("GPL"); +#ifndef SUBJECT +#define SUBJECT "world" +#endif + /* Our init function: returns 0 if successfull, an error code, otherwise. */ static int hello_init(void) { /* printk is just like printf, but without floating point support. */ - printk(KERN_ALERT "Hello, world!\n"); + printk(KERN_ALERT "Hello, " SUBJECT "!\n"); return 0; } @@ -16,7 +20,7 @@ static int hello_init(void) static void hello_exit(void) { /* KERN_ALERT is a string macro prepended to our message. */ - printk(KERN_ALERT "Goodbye, cruel world!\n"); + printk(KERN_ALERT "Goodbye, cruel " SUBJECT "!\n"); } /* Here, we declare our module init and exit functions. */