Skip to contentSkip to conversation

printk function

PATCH In review Rafael Pereira 4 participants 5 messages Jan 17, 2005 – Jan 19, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk function

The patch for the printk function. I found more than 20k occurences that needs modification, to include KERN_* constants. There're lots of changes to be done.

http://www.kernelhacker.net/patch/patch-2.6.11-rc1-printk.tar.bz2

Signature · 4 lines
 Rafael Pereira
 GNU/Linux Registered User #286151
 BSD Registered User #51196
 Be free. Use free software.

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 5 lines · Rafael Pereira

The patch for the printk function. I found more than 20k occurences that needs modification, to include KERN_* constants. There're lots of changes to be done.

http://www.kernelhacker.net/patch/patch-2.6.11-rc1-printk.tar.bz2

please split up and send one patch touching one file / mail. that's not a scriptable work, please be carefull, and send your patches in for review.
you may want to read Documentation/SubmittingPatches thanks

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 printk function

In reply to Rafael Pereira

The patch for the printk function. I found more than 20k occurences that needs modification, to include KERN_* constants. There're lots of changes to be done.

http://www.kernelhacker.net/patch/patch-2.6.11-rc1-printk.tar.bz2

Signature · 4 lines
 Rafael Pereira
 GNU/Linux Registered User #286151
 BSD Registered User #51196
 Be free. Use free software.

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Rafael Pereira

arch/alpha/kernel/core_wildfire.c

Quoted 7 lines · Rafael Pereira

The patch for the printk function.

arch/alpha/kernel/core_wildfire.c +1 -1
 
-	printk(" hard_qbb_map: ");
+	printk(KERN_ERR " hard_qbb_map: ");

Notice this printk doesn't have trailing "\n".

arch/alpha/kernel/core_wildfire.c

Quoted 4 lines
arch/alpha/kernel/core_wildfire.c +1 -1
 	for (i = 0; i < WILDFIRE_MAX_QBB; i++)
 	    if (wildfire_hard_qbb_map[i] == QBB_MAP_EMPTY)
-		printk("--- ");
+		printk(KERN_ERR "--- ");

Adding KERN_* in such loops screwes the output.

arch/alpha/kernel/core_wildfire.c

Quoted 5 lines
arch/alpha/kernel/core_wildfire.c +2 -2
 	    else
-		printk("%3d ", wildfire_hard_qbb_map[i]);
-	printk("\n");
+		printk(KERN_ERR "%3d ", wildfire_hard_qbb_map[i]);
+	printk(KERN_ERR "\n");

Not every printk instance should use KERN_*. Domen, I think this should be added to TODO.

arch/alpha/kernel/core_wildfire.c

Quoted 6 lines
arch/alpha/kernel/core_wildfire.c +2 -2
-	printk(" soft_qbb_map: ");
+	printk(KERN_ERR " soft_qbb_map: ");
 	for (i = 0; i < WILDFIRE_MAX_QBB; i++)
 	    if (wildfire_soft_qbb_map[i] == QBB_MAP_EMPTY)
-		printk("--- ");
+		printk(KERN_ERR "--- ");
		       ^^^^^^^^

arch/alpha/kernel/core_wildfire.c

Quoted 4 lines
arch/alpha/kernel/core_wildfire.c +1 -2
 	    else
-		printk("%3d ", wildfire_soft_qbb_map[i]);
-	printk("\n");
+		printk(KERN_ERR "%3d ", wildfire_soft_qbb_map[i]);
		       ^^^^^^^^

arch/alpha/kernel/core_wildfire.c

Quoted 1 line
arch/alpha/kernel/core_wildfire.c +1 -0
+	printk(KERN_ERR "\n");
	       ^^^^^^^^

Same error.

arch/ppc64/kernel/prom.c

Quoted 9 lines
arch/ppc64/kernel/prom.c +1 -2
 
 			printk(KERN_DEBUG "hmmm, got %d intr cells for %s:", n,
 			       node->full_name);
 			for (j = 0; j < n; ++j)
-				printk(" %d", irq[j]);
-			printk("\n");
+				printk(KERN_DEBUG " %d", irq[j]);
				       ^^^^^^^^^^

arch/ppc64/kernel/prom.c

Quoted 1 line
arch/ppc64/kernel/prom.c +1 -0
+			printk(KERN_DEBUG "\n");
			       ^^^^^^^^^^

arch/sparc64/kernel/smp.c

Quoted 12 lines
arch/sparc64/kernel/smp.c +2 -2
 
 #ifdef CAPTURE_DEBUG
-		printk("CPU[%d]: Sending penguins to jail...",
+		printk(KERN_DEBUG "CPU[%d]: Sending penguins to jail...",
 		       smp_processor_id());
 #endif
 
 #ifdef CAPTURE_DEBUG
-		printk("done\n");
+		printk(KERN_DEBUG "done\n");
		       ^^^^^^^^^^

arch/um/kernel/irq_user.c

Quoted 5 lines
arch/um/kernel/irq_user.c +1 -1
 
-		printk("free_irq_later found no irq, irq = %d, "
+		printk(fKERN_ERR "free_irq_later found no irq, irq = %d, "

Oops, a typo.

arch/um/kernel/sigio_user.c

Quoted 9 lines
arch/um/kernel/sigio_user.c +2 -2
 
-	printk("Checking that host ptys support output SIGIO...");
+	printk(KERN_WARNING "Checking that host ptys support output SIGIO...");
 
 	if(got_sigio){
-		printk("Yes\n");
+		printk(KERN_ERR "Yes\n");
		       ^^^^^^^^

arch/um/kernel/sigio_user.c

Quoted 4 lines
arch/um/kernel/sigio_user.c +1 -1
 		pty_output_sigio = 1;
 	}
-	else if(n == -EAGAIN) printk("No, enabling workaround\n");
+	else if(n == -EAGAIN) printk(KERN_ERR "No, enabling workaround\n");
				     ^^^^^^^^

arch/um/kernel/sigio_user.c

Quoted 9 lines

static void tty_close(int master, int slave)
{

arch/um/kernel/sigio_user.c +2 -2
-	printk("Checking that host ptys support SIGIO on close...");
+	printk(KERN_INFO "Checking that host ptys support SIGIO on close...");
 
 	os_close_file(slave);
 	if(got_sigio){
-		printk("Yes\n");
+		printk(KERN_INFO "Yes\n");
		       ^^^^^^^^^

arch/um/kernel/sigio_user.c

Quoted 4 lines
arch/um/kernel/sigio_user.c +1 -1
 		pty_close_sigio = 1;
 	}
-	else printk("No, enabling workaround\n");
+	else printk(KERN_WARNING "No, enabling workaround\n");
		    ^^^^^^^^^^^^

drivers/block/acsi.c line 1671

Quoted 8 lines
drivers/block/acsi.c +1 -1
@@ -1668,22 +1668,22 @@
 				printk( KERN_INFO "Detected ");
 				switch (aip->type) {
 				  case HARDDISK:
-					printk("disk");
+					printk(KERN_INFO "disk");
					       ^^^^^^^^^

drivers/block/acsi.c line 1674

Quoted 4 lines
drivers/block/acsi.c +1 -1
 					break;
 				  case CDROM:
-					printk("cdrom");
+					printk(KERN_INFO "cdrom");
					       ^^^^^^^^^

drivers/block/acsi.c line 1681

Quoted 9 lines
drivers/block/acsi.c +2 -2
 					break;
 				  default:
 				}
-				printk(" ad%c at id %d lun %d ",
+				printk(KERN_INFO " ad%c at id %d lun %d ",
 				       'a' + NDevices, target, lun);
 				if (aip->removable) 
-					printk("(removable) ");
+					printk(KERN_INFO "(removable) ");
					       ^^^^^^^^^

drivers/block/acsi.c line 1683

Quoted 3 lines
drivers/block/acsi.c +1 -1
 				if (aip->read_only) 
-					printk("(read-only) ");
+					printk(KERN_INFO "(read-only) ");
					       ^^^^^^^^^

drivers/block/acsi.c line 1685

Quoted 4 lines
drivers/block/acsi.c +1 -2
 				if (aip->size == DEFAULT_SIZE)
-					printk(" unkown size, using default ");
-				printk("%ld MByte\n",
+					printk(KERN_INFO " unkown size, using default ");
					       ^^^^^^^^^

drivers/block/acsi.c line 1686

Quoted 1 line
drivers/block/acsi.c +1 -0
+				printk(KERN_INFO "%ld MByte\n",
				       ^^^^^^^^^

kernel/module.c line 2065

Quoted 12 lines
kernel/module.c +2 -3
@@ -2060,10 +2060,10 @@
 {
 	struct module *mod;
 
-	printk("Modules linked in:");
+	printk(KERN_INFO "Modules linked in:");
 	list_for_each_entry(mod, &modules, list)
-		printk(" %s", mod->name);
-	printk("\n");
+		printk(KERN_INFO " %s", mod->name);
		       ^^^^^^^^^

kernel/module.c line 2066

Quoted 1 line
kernel/module.c +1 -0
+	printk(KERN_INFO "\n");
	       ^^^^^^^^^

kernel/power/disk.c

Quoted 9 lines
kernel/power/disk.c +2 -2
 
-	printk("Freeing memory...  ");
+	printk(KERN_INFO "Freeing memory...  ");
 	while ((tmp = shrink_all_memory(10000))) {
 		pages += tmp;
-		printk("\b%c", p[i]);
+		printk(KERN_INFO "\b%c", p[i]);
		       ^^^^^^^^^

kernel/power/disk.c

Quoted 2 lines
kernel/power/disk.c +1 -1
-	printk("\bdone (%li pages freed)\n", pages);
+	printk(KERN_INFO "\bdone (%li pages freed)\n", pages);
	       ^^^^^^^^^

Many more left. Double check that you aren't adding KERN_* in the _middle_ of a log message, ok? Also minimal splitting would be nice (arch/alpha/* part, kernel/* part, ...).

Alexey

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Rafael Pereira
Quoted 5 lines · Alexey Dobriyan

Many more left. Double check that you aren't adding KERN_* in the _middle_ of a log message, ok? Also minimal splitting would be nice (arch/alpha/* part, kernel/* part, ...).

Alexey

Alexey,

Thank you for your comments. I'll do it better next time :)

Rafael.

Signature · 4 lines
 Rafael Pereira
 GNU/Linux Registered User #286151
 BSD Registered User #51196
 Be free. Use free software.

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors