public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add prink KERN_* suffixes
@ 2003-03-13 16:41 Daniele Venzano
  2003-03-13 17:22 ` Andreas Schwab
  2003-03-13 21:43 ` Robert Love
  0 siblings, 2 replies; 4+ messages in thread
From: Daniele Venzano @ 2003-03-13 16:41 UTC (permalink / raw)
  To: Linux Kernel Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 753 bytes --]

Looking at the Kernel Janitor TODO list I saw this:
------------------------------------------------------------------------
From: Andrey Panin <pazke at orbita dot don dot sitek dot net>

- check printk() calls (should include appropriate KERN_* constant).

------------------------------------------------------------------------

The following three patches add KERN_* prefixes to all printk() in
3c509.c 8390.c hp.c and slhc.c

I don't know if I got the priorities right, so some feedback is
appreciated... 

The patches are against 2.5.64 and are also available at:
http://digilander.libero.it/webvenza/kernel_patches.html

-- 
----------------------------------------
Daniele Venzano
Web: http://digilander.iol.it/webvenza/


[-- Attachment #1.2: 3c509_printk.diff --]
[-- Type: text/plain, Size: 8969 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/3c509.c linux-2.5.64-work/drivers/net/3c509.c
--- linux-2.5.64/drivers/net/3c509.c	2003-03-06 11:41:18.000000000 +0100
+++ linux-2.5.64-work/drivers/net/3c509.c	2003-03-13 12:28:39.000000000 +0100
@@ -316,14 +316,14 @@
 
 	{
 		const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
-		printk("%s: 3c5x9 at %#3.3lx, %s port, address ",
+		printk(KERN_INFO "%s: 3c5x9 at %#3.3lx, %s port, address ",
 			dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)]);
 	}
 
 	/* Read in the station address. */
 	for (i = 0; i < 6; i++)
-		printk(" %2.2x", dev->dev_addr[i]);
-	printk(", IRQ %d.\n", dev->irq);
+		printk(KERN_INFO " %2.2x", dev->dev_addr[i]);
+	printk(KERN_INFO ", IRQ %d.\n", dev->irq);
 
 	if (el3_debug > 0)
 		printk(KERN_INFO "%s" KERN_INFO "%s", versionA, versionB);
@@ -399,7 +399,7 @@
 			}
 			irq = pnp_irq(idev, 0);
 			if (el3_debug > 3)
-				printk ("ISAPnP reports %s at i/o 0x%x, irq %d\n",
+				printk (KERN_DEBUG "ISAPnP reports %s at i/o 0x%x, irq %d\n",
 					(char*) el3_isapnp_adapters[i].driver_data, ioaddr, irq);
 			EL3WINDOW(0);
 			for (j = 0; j < 3; j++)
@@ -432,7 +432,7 @@
 	}
 	if (id_port >= 0x200) {
 		/* Rare -- do we really need a warning? */
-		printk(" WARNING: No I/O port available for 3c509 activation.\n");
+		printk(KERN_WARNING " No I/O port available for 3c509 activation.\n");
 		return -ENODEV;
 	}
 	/* Next check for all ISA bus boards by sending the ID sequence to the
@@ -475,7 +475,7 @@
 			    phys_addr[2] == el3_isapnp_phys_addr[i][2])
 			{
 				if (el3_debug > 3)
-					printk("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
+					printk(KERN_DEBUG "3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
 						phys_addr[0] & 0xff, phys_addr[0] >> 8,
 						phys_addr[1] & 0xff, phys_addr[1] >> 8,
 						phys_addr[2] & 0xff, phys_addr[2] >> 8);
@@ -586,7 +586,7 @@
 		irq = pos5 & 0x0f;
 
 
-		printk("3c529: found %s at slot %d\n",
+		printk(KERN_INFO "3c529: found %s at slot %d\n",
 			   el3_mca_adapter_names[mdev->index], slot + 1);
 
 		/* claim the slot */
@@ -599,7 +599,7 @@
 		irq = mca_device_transform_irq(mdev, irq);
 		ioaddr = mca_device_transform_ioport(mdev, ioaddr); 
 		if (el3_debug > 2) {
-				printk("3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
+				printk(KERN_DEBUG "3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
 		}
 		EL3WINDOW(0);
 		for (i = 0; i < 3; i++) {
@@ -721,7 +721,7 @@
 		word = (word << 1) + (inb(id_port) & 0x01);
 
 	if (el3_debug > 3)
-		printk("  3c509 EEPROM word %d %#4.4x.\n", index, word);
+		printk(KERN_DEBUG "  3c509 EEPROM word %d %#4.4x.\n", index, word);
 
 	return word;
 }
@@ -742,13 +742,13 @@
 
 	EL3WINDOW(0);
 	if (el3_debug > 3)
-		printk("%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
 			   dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
 
 	el3_up(dev);
 
 	if (el3_debug > 3)
-		printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
+		printk(KERN_DEBUG "%s: Opened 3c509  IRQ %d  status %4.4x.\n",
 			   dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
 
 	return 0;
@@ -761,7 +761,7 @@
 	int ioaddr = dev->base_addr;
 
 	/* Transmitter timeout, serious problems. */
-	printk("%s: transmit timed out, Tx_status %2.2x status %4.4x "
+	printk(KERN_ERR "%s: transmit timed out, Tx_status %2.2x status %4.4x "
 		   "Tx FIFO room %d.\n",
 		   dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
 		   inw(ioaddr + TX_FREE));
@@ -786,7 +786,7 @@
 	lp->stats.tx_bytes += skb->len;
 	
 	if (el3_debug > 4) {
-		printk("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
+		printk(KERN_DEBUG "%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
 			   dev->name, skb->len, inw(ioaddr + EL3_STATUS));
 	}
 #if 0
@@ -867,7 +867,7 @@
 	int i = max_interrupt_work;
 
 	if (dev == NULL) {
-		printk ("el3_interrupt(): irq %d for unknown device.\n", irq);
+		printk (KERN_INFO "el3_interrupt(): irq %d for unknown device.\n", irq);
 		return;
 	}
 
@@ -878,7 +878,7 @@
 
 	if (el3_debug > 4) {
 		status = inw(ioaddr + EL3_STATUS);
-		printk("%s: interrupt, status %4.4x.\n", dev->name, status);
+		printk(KERN_DEBUG "%s: interrupt, status %4.4x.\n", dev->name, status);
 	}
 
 	while ((status = inw(ioaddr + EL3_STATUS)) &
@@ -889,7 +889,7 @@
 
 		if (status & TxAvailable) {
 			if (el3_debug > 5)
-				printk("	TX room bit was handled.\n");
+				printk(KERN_DEBUG "	TX room bit was handled.\n");
 			/* There's room in the FIFO for a full-sized packet. */
 			outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
 			netif_wake_queue (dev);
@@ -928,7 +928,7 @@
 		}
 
 		if (--i < 0) {
-			printk("%s: Infinite loop in interrupt, status %4.4x.\n",
+			printk(KERN_ERR "%s: Infinite loop in interrupt, status %4.4x.\n",
 				   dev->name, status);
 			/* Clear all interrupts. */
 			outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -939,7 +939,7 @@
 	}
 
 	if (el3_debug > 4) {
-		printk("%s: exiting interrupt, status %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: exiting interrupt, status %4.4x.\n", dev->name,
 			   inw(ioaddr + EL3_STATUS));
 	}
 	spin_unlock(&lp->lock);
@@ -975,7 +975,7 @@
 	int ioaddr = dev->base_addr;
 
 	if (el3_debug > 5)
-		printk("   Updating the statistics.\n");
+		printk(KERN_DEBUG "   Updating the statistics.\n");
 	/* Turn off statistics updates while reading. */
 	outw(StatsDisable, ioaddr + EL3_CMD);
 	/* Switch to the stats window, and read everything. */
@@ -1006,7 +1006,7 @@
 	short rx_status;
 
 	if (el3_debug > 5)
-		printk("   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
+		printk(KERN_DEBUG "   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
 			   inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
 	while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) {
 		if (rx_status & 0x4000) { /* Error, update stats. */
@@ -1029,7 +1029,7 @@
 			skb = dev_alloc_skb(pkt_len+5);
 			lp->stats.rx_bytes += pkt_len;
 			if (el3_debug > 4)
-				printk("Receiving packet size %d status %4.4x.\n",
+				printk(KERN_DEBUG "Receiving packet size %d status %4.4x.\n",
 					   pkt_len, rx_status);
 			if (skb != NULL) {
 				skb->dev = dev;
@@ -1054,7 +1054,7 @@
 			outw(RxDiscard, ioaddr + EL3_CMD);
 			lp->stats.rx_dropped++;
 			if (el3_debug)
-				printk("%s: Couldn't allocate a sk_buff of size %d.\n",
+				printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
 					   dev->name, pkt_len);
 		}
 		inw(ioaddr + EL3_STATUS); 				/* Delay. */
@@ -1080,7 +1080,7 @@
 		static int old;
 		if (old != dev->mc_count) {
 			old = dev->mc_count;
-			printk("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
+			printk(KERN_INFO "%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
 		}
 	}
 	spin_lock_irqsave(&lp->lock, flags);
@@ -1103,7 +1103,7 @@
 	struct el3_private *lp = (struct el3_private *)dev->priv;
 	
 	if (el3_debug > 2)
-		printk("%s: Shutting down ethercard.\n", dev->name);
+		printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
 
 	el3_down(dev);
 
@@ -1409,30 +1409,30 @@
 		EL3WINDOW(4);
 		net_diag = inw(ioaddr + WN4_NETDIAG);
 		net_diag = (net_diag | FD_ENABLE); /* temporarily assume full-duplex will be set */
-		printk("%s: ", dev->name);
+		printk(KERN_INFO "%s: ", dev->name);
 		switch (dev->if_port & 0x0c) {
 			case 12:
 				/* force full-duplex mode if 3c5x9b */
 				if (sw_info & 0x000f) {
-					printk("Forcing 3c5x9b full-duplex mode");
+					printk(KERN_INFO "Forcing 3c5x9b full-duplex mode");
 					break;
 				}
 			case 8:
 				/* set full-duplex mode based on eeprom config setting */
 				if ((sw_info & 0x000f) && (sw_info & 0x8000)) {
-					printk("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
+					printk(KERN_INFO "Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
 					break;
 				}
 			default:
 				/* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */
-				printk("Setting 3c5x9/3c5x9B half-duplex mode");
+				printk(KERN_INFO "Setting 3c5x9/3c5x9B half-duplex mode");
 				net_diag = (net_diag & ~FD_ENABLE); /* disable full duplex */
 		}
 
 		outw(net_diag, ioaddr + WN4_NETDIAG);
-		printk(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
+		printk(KERN_INFO " if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
 		if (el3_debug > 3)
-			printk("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
+			printk(KERN_DEBUG "%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
 		/* Enable link beat and jabber check. */
 		outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA);
 	}

[-- Attachment #1.3: 8390_printk.diff --]
[-- Type: text/plain, Size: 2593 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/8390.c linux-2.5.64-work/drivers/net/8390.c
--- linux-2.5.64/drivers/net/8390.c	2003-03-06 11:41:18.000000000 +0100
+++ linux-2.5.64-work/drivers/net/8390.c	2003-03-13 12:43:54.000000000 +0100
@@ -430,7 +430,7 @@
     
 	if (dev == NULL) 
 	{
-		printk ("net_interrupt(): irq %d for unknown device.\n", irq);
+		printk (KERN_INFO "net_interrupt(): irq %d for unknown device.\n", irq);
 		return;
 	}
     
@@ -448,8 +448,8 @@
 #if 1 /* This might just be an interrupt for a PCI device sharing this line */
 		/* The "irqlock" check is only for testing. */
 		printk(ei_local->irqlock
-			   ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
-			   : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
+			   ? KERN_DEBUG "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
+			   : KERN_DEBUG "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
 			   dev->name, inb_p(e8390_base + EN0_ISR),
 			   inb_p(e8390_base + EN0_IMR));
 #endif
@@ -547,15 +547,15 @@
 #ifdef VERBOSE_ERROR_DUMP
 	printk(KERN_DEBUG "%s: transmitter error (%#2x): ", dev->name, txsr);
 	if (txsr & ENTSR_ABT)
-		printk("excess-collisions ");
+		printk(KERN_DEBUG "excess-collisions ");
 	if (txsr & ENTSR_ND)
-		printk("non-deferral ");
+		printk(KERN_DEBUG "non-deferral ");
 	if (txsr & ENTSR_CRS)
-		printk("lost-carrier ");
+		printk(KERN_DEBUG "lost-carrier ");
 	if (txsr & ENTSR_FU)
-		printk("FIFO-underrun ");
+		printk(KERN_DEBUG "FIFO-underrun ");
 	if (txsr & ENTSR_CDH)
-		printk("lost-heartbeat ");
+		printk(KERN_DEBUG "lost-heartbeat ");
 	printk("\n");
 #endif
 
@@ -615,7 +615,7 @@
 	else if (ei_local->tx2 < 0) 
 	{
 		if (ei_local->lasttx != 2  &&  ei_local->lasttx != -2)
-			printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
+			printk(KERN_ERR "%s: bogus last_tx_buffer %d, tx2=%d.\n",
 				ei_local->name, ei_local->lasttx, ei_local->tx2);
 		ei_local->tx2 = 0;
 		if (ei_local->tx1 > 0) 
@@ -782,7 +782,7 @@
 		
 		/* This _should_ never happen: it's here for avoiding bad clones. */
 		if (next_frame >= ei_local->stop_page) {
-			printk("%s: next frame inconsistency, %#2x\n", dev->name,
+			printk(KERN_ERR "%s: next frame inconsistency, %#2x\n", dev->name,
 				   next_frame);
 			next_frame = ei_local->rx_start_page;
 		}
@@ -1008,7 +1008,7 @@
 int ethdev_init(struct net_device *dev)
 {
 	if (ei_debug > 1)
-		printk(version);
+		printk(KERN_DEBUG version);
     
 	if (dev->priv == NULL) 
 	{

[-- Attachment #1.4: slhc_hp_printk.diff --]
[-- Type: text/plain, Size: 4686 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/hp.c linux-2.5.64-work/drivers/net/hp.c
--- linux-2.5.64/drivers/net/hp.c	2002-11-30 15:07:12.000000000 +0100
+++ linux-2.5.64-work/drivers/net/hp.c	2003-03-13 12:52:11.000000000 +0100
@@ -129,19 +129,19 @@
 	}
 
 	if (ei_debug  &&  version_printed++ == 0)
-		printk(version);
+		printk(KERN_INFO version);
 
 	/* Allocate dev->priv and fill in 8390 specific dev fields. */
 	if (ethdev_init(dev)) {
-		printk (" unable to get memory for dev->priv.\n");
+		printk (KERN_ERR " unable to get memory for dev->priv.\n");
 		retval = -ENOMEM;
 		goto out;
 	}
 
-	printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
+	printk(KERN_INFO "%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
 
 	for(i = 0; i < ETHER_ADDR_LEN; i++)
-		printk(" %2.2x", dev->dev_addr[i] = inb(ioaddr + i));
+		printk(KERN_INFO " %2.2x", dev->dev_addr[i] = inb(ioaddr + i));
 
 	/* Snarf the interrupt now.  Someday this could be moved to open(). */
 	if (dev->irq < 2) {
@@ -157,14 +157,14 @@
 				outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE);
 				if (irq == probe_irq_off(cookie)		 /* It's a good IRQ line! */
 					&& request_irq (irq, ei_interrupt, 0, dev->name, dev) == 0) {
-					printk(" selecting IRQ %d.\n", irq);
+					printk(KERN_INFO " selecting IRQ %d.\n", irq);
 					dev->irq = *irqp;
 					break;
 				}
 			}
 		} while (*++irqp);
 		if (*irqp == 0) {
-			printk(" no free IRQ lines.\n");
+			printk(KERN_ERR " no free IRQ lines.\n");
 			retval = -EBUSY;
 			goto out1;
 		}
@@ -172,7 +172,7 @@
 		if (dev->irq == 2)
 			dev->irq = 9;
 		if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) {
-			printk (" unable to get IRQ %d.\n", dev->irq);
+			printk (KERN_ERR " unable to get IRQ %d.\n", dev->irq);
 			goto out1;
 		}
 	}
@@ -223,7 +223,7 @@
 	int hp_base = dev->base_addr - NIC_OFFSET;
 	int saved_config = inb_p(hp_base + HP_CONFIGURE);
 
-	if (ei_debug > 1) printk("resetting the 8390 time=%ld...", jiffies);
+	if (ei_debug > 1) printk(KERN_DEBUG "resetting the 8390 time=%ld...", jiffies);
 	outb_p(0x00, hp_base + HP_CONFIGURE);
 	ei_status.txing = 0;
 	/* Pause just a few cycles for the hardware reset to take place. */
@@ -233,9 +233,9 @@
 	udelay(5);
 
 	if ((inb_p(hp_base+NIC_OFFSET+EN0_ISR) & ENISR_RESET) == 0)
-		printk("%s: hp_reset_8390() did not complete.\n", dev->name);
+		printk(KERN_WARNING "%s: hp_reset_8390() did not complete.\n", dev->name);
 
-	if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
+	if (ei_debug > 1) printk(KERN_DEBUG "8390 reset done (%ld).", jiffies);
 	return;
 }
 
@@ -295,7 +295,7 @@
 	  int addr = (high << 8) + low;
 	  /* Check only the lower 8 bits so we can ignore ring wrap. */
 	  if (((ring_offset + xfer_count) & 0xff) != (addr & 0xff))
-		printk("%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
+		printk(KERN_WARNING "%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
 			   dev->name, ring_offset + xfer_count, addr);
 	}
 	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
@@ -352,7 +352,7 @@
 	  int low  = inb_p(nic_base + EN0_RSARLO);
 	  int addr = (high << 8) + low;
 	  if ((start_page << 8) + count != addr)
-		printk("%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
+		printk(KERN_WARNING "%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
 			   dev->name, (start_page << 8) + count, addr);
 	}
 	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/slhc.c linux-2.5.64-work/drivers/net/slhc.c
--- linux-2.5.64/drivers/net/slhc.c	2003-03-06 11:41:21.000000000 +0100
+++ linux-2.5.64-work/drivers/net/slhc.c	2003-03-13 12:47:40.000000000 +0100
@@ -696,7 +696,7 @@
 void slhc_i_status(struct slcompress *comp)
 {
 	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d Bad, %d Tossed\n",
+		printk(KERN_INFO "\t%d Cmp, %d Uncmp, %d Bad, %d Tossed\n",
 			comp->sls_i_compressed,
 			comp->sls_i_uncompressed,
 			comp->sls_i_error,
@@ -708,12 +708,12 @@
 void slhc_o_status(struct slcompress *comp)
 {
 	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
+		printk(KERN_INFO "\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
 			comp->sls_o_compressed,
 			comp->sls_o_uncompressed,
 			comp->sls_o_tcp,
 			comp->sls_o_nontcp);
-		printk("\t%10d Searches, %10d Misses\n",
+		printk(KERN_INFO "\t%10d Searches, %10d Misses\n",
 			comp->sls_o_searches,
 			comp->sls_o_misses);
 	}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] add prink KERN_* suffixes
  2003-03-13 16:41 [PATCH] add prink KERN_* suffixes Daniele Venzano
@ 2003-03-13 17:22 ` Andreas Schwab
  2003-03-13 21:43 ` Robert Love
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2003-03-13 17:22 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Daniele Venzano <webvenza@libero.it> writes:

|> diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/3c509.c linux-2.5.64-work/drivers/net/3c509.c
|> --- linux-2.5.64/drivers/net/3c509.c	2003-03-06 11:41:18.000000000 +0100
|> +++ linux-2.5.64-work/drivers/net/3c509.c	2003-03-13 12:28:39.000000000 +0100
|> @@ -316,14 +316,14 @@
|>  
|>  	{
|>  		const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
|> -		printk("%s: 3c5x9 at %#3.3lx, %s port, address ",
|> +		printk(KERN_INFO "%s: 3c5x9 at %#3.3lx, %s port, address ",
|>  			dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)]);
|>  	}
|>  
|>  	/* Read in the station address. */
|>  	for (i = 0; i < 6; i++)
|> -		printk(" %2.2x", dev->dev_addr[i]);
|> -	printk(", IRQ %d.\n", dev->irq);
|> +		printk(KERN_INFO " %2.2x", dev->dev_addr[i]);
|> +	printk(KERN_INFO ", IRQ %d.\n", dev->irq);

This is wrong, a KERN_* prefix is only recognized after a newline.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH] add prink KERN_* suffixes
  2003-03-13 16:41 [PATCH] add prink KERN_* suffixes Daniele Venzano
  2003-03-13 17:22 ` Andreas Schwab
@ 2003-03-13 21:43 ` Robert Love
  2003-03-14 18:45   ` Daniele Venzano
  1 sibling, 1 reply; 4+ messages in thread
From: Robert Love @ 2003-03-13 21:43 UTC (permalink / raw)
  To: Daniele Venzano; +Cc: Linux Kernel Mailing List

On Thu, 2003-03-13 at 11:41, Daniele Venzano wrote:
>         /* Read in the station address. */
>         for (i = 0; i < 6; i++)
> -               printk(" %2.2x", dev->dev_addr[i]);
> -       printk(", IRQ %d.\n", dev->irq);
> +               printk(KERN_INFO " %2.2x", dev->dev_addr[i]);
> +       printk(KERN_INFO ", IRQ %d.\n", dev->irq);


The loglevels only work after a newline.

What you can do is printk() the loglevel before the for loop.  Or just
leave this one alone.

	Robert Love


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

* Re: [PATCH] add prink KERN_* suffixes
  2003-03-13 21:43 ` Robert Love
@ 2003-03-14 18:45   ` Daniele Venzano
  0 siblings, 0 replies; 4+ messages in thread
From: Daniele Venzano @ 2003-03-14 18:45 UTC (permalink / raw)
  To: Linux Kernel Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 669 bytes --]

> The loglevels only work after a newline.
That's sane... I could think to it by myself in the first place. :-(

Here there are new patches, checked out for the newline stuff, always
against 2.5.64 and modifing the following files from drivers/net/:
3c509.c (first patch)
8390.c (second patch)
hp.c and hldc.c (third patch)

I also made similar work on 3c503.c, but I had to run it through indent
before, so the patch is big (~35k uncompressed). It can be found (with
all the others) at:

http://digilander.libero.it/webvenza/kernel_patches.html

-- 
----------------------------------------
Daniele Venzano
Web: http://digilander.iol.it/webvenza/


[-- Attachment #1.2: 3c509_printk.diff --]
[-- Type: text/plain, Size: 7819 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/3c509.c linux-2.5.64-work/drivers/net/3c509.c
--- linux-2.5.64/drivers/net/3c509.c	2003-03-14 17:37:53.000000000 +0100
+++ linux-2.5.64-work/drivers/net/3c509.c	2003-03-14 17:56:05.000000000 +0100
@@ -316,7 +316,7 @@
 
 	{
 		const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
-		printk("%s: 3c5x9 at %#3.3lx, %s port, address ",
+		printk(KERN_INFO "%s: 3c5x9 at %#3.3lx, %s port, address ",
 			dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)]);
 	}
 
@@ -399,7 +399,7 @@
 			}
 			irq = pnp_irq(idev, 0);
 			if (el3_debug > 3)
-				printk ("ISAPnP reports %s at i/o 0x%x, irq %d\n",
+				printk (KERN_DEBUG "ISAPnP reports %s at i/o 0x%x, irq %d\n",
 					(char*) el3_isapnp_adapters[i].driver_data, ioaddr, irq);
 			EL3WINDOW(0);
 			for (j = 0; j < 3; j++)
@@ -432,7 +432,7 @@
 	}
 	if (id_port >= 0x200) {
 		/* Rare -- do we really need a warning? */
-		printk(" WARNING: No I/O port available for 3c509 activation.\n");
+		printk(KERN_WARNING " No I/O port available for 3c509 activation.\n");
 		return -ENODEV;
 	}
 	/* Next check for all ISA bus boards by sending the ID sequence to the
@@ -475,7 +475,7 @@
 			    phys_addr[2] == el3_isapnp_phys_addr[i][2])
 			{
 				if (el3_debug > 3)
-					printk("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
+					printk(KERN_DEBUG "3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
 						phys_addr[0] & 0xff, phys_addr[0] >> 8,
 						phys_addr[1] & 0xff, phys_addr[1] >> 8,
 						phys_addr[2] & 0xff, phys_addr[2] >> 8);
@@ -586,7 +586,7 @@
 		irq = pos5 & 0x0f;
 
 
-		printk("3c529: found %s at slot %d\n",
+		printk(KERN_INFO "3c529: found %s at slot %d\n",
 			   el3_mca_adapter_names[mdev->index], slot + 1);
 
 		/* claim the slot */
@@ -599,7 +599,7 @@
 		irq = mca_device_transform_irq(mdev, irq);
 		ioaddr = mca_device_transform_ioport(mdev, ioaddr); 
 		if (el3_debug > 2) {
-				printk("3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
+				printk(KERN_DEBUG "3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
 		}
 		EL3WINDOW(0);
 		for (i = 0; i < 3; i++) {
@@ -721,7 +721,7 @@
 		word = (word << 1) + (inb(id_port) & 0x01);
 
 	if (el3_debug > 3)
-		printk("  3c509 EEPROM word %d %#4.4x.\n", index, word);
+		printk(KERN_DEBUG "  3c509 EEPROM word %d %#4.4x.\n", index, word);
 
 	return word;
 }
@@ -742,13 +742,13 @@
 
 	EL3WINDOW(0);
 	if (el3_debug > 3)
-		printk("%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
 			   dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
 
 	el3_up(dev);
 
 	if (el3_debug > 3)
-		printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
+		printk(KERN_DEBUG "%s: Opened 3c509  IRQ %d  status %4.4x.\n",
 			   dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
 
 	return 0;
@@ -761,7 +761,7 @@
 	int ioaddr = dev->base_addr;
 
 	/* Transmitter timeout, serious problems. */
-	printk("%s: transmit timed out, Tx_status %2.2x status %4.4x "
+	printk(KERN_ERR "%s: transmit timed out, Tx_status %2.2x status %4.4x "
 		   "Tx FIFO room %d.\n",
 		   dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
 		   inw(ioaddr + TX_FREE));
@@ -786,7 +786,7 @@
 	lp->stats.tx_bytes += skb->len;
 	
 	if (el3_debug > 4) {
-		printk("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
+		printk(KERN_DEBUG "%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
 			   dev->name, skb->len, inw(ioaddr + EL3_STATUS));
 	}
 #if 0
@@ -867,7 +867,7 @@
 	int i = max_interrupt_work;
 
 	if (dev == NULL) {
-		printk ("el3_interrupt(): irq %d for unknown device.\n", irq);
+		printk (KERN_INFO "el3_interrupt(): irq %d for unknown device.\n", irq);
 		return;
 	}
 
@@ -878,7 +878,7 @@
 
 	if (el3_debug > 4) {
 		status = inw(ioaddr + EL3_STATUS);
-		printk("%s: interrupt, status %4.4x.\n", dev->name, status);
+		printk(KERN_DEBUG "%s: interrupt, status %4.4x.\n", dev->name, status);
 	}
 
 	while ((status = inw(ioaddr + EL3_STATUS)) &
@@ -889,7 +889,7 @@
 
 		if (status & TxAvailable) {
 			if (el3_debug > 5)
-				printk("	TX room bit was handled.\n");
+				printk(KERN_DEBUG "	TX room bit was handled.\n");
 			/* There's room in the FIFO for a full-sized packet. */
 			outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
 			netif_wake_queue (dev);
@@ -928,7 +928,7 @@
 		}
 
 		if (--i < 0) {
-			printk("%s: Infinite loop in interrupt, status %4.4x.\n",
+			printk(KERN_ERR "%s: Infinite loop in interrupt, status %4.4x.\n",
 				   dev->name, status);
 			/* Clear all interrupts. */
 			outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -939,7 +939,7 @@
 	}
 
 	if (el3_debug > 4) {
-		printk("%s: exiting interrupt, status %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: exiting interrupt, status %4.4x.\n", dev->name,
 			   inw(ioaddr + EL3_STATUS));
 	}
 	spin_unlock(&lp->lock);
@@ -975,7 +975,7 @@
 	int ioaddr = dev->base_addr;
 
 	if (el3_debug > 5)
-		printk("   Updating the statistics.\n");
+		printk(KERN_DEBUG "   Updating the statistics.\n");
 	/* Turn off statistics updates while reading. */
 	outw(StatsDisable, ioaddr + EL3_CMD);
 	/* Switch to the stats window, and read everything. */
@@ -1006,7 +1006,7 @@
 	short rx_status;
 
 	if (el3_debug > 5)
-		printk("   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
+		printk(KERN_DEBUG "   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
 			   inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
 	while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) {
 		if (rx_status & 0x4000) { /* Error, update stats. */
@@ -1029,7 +1029,7 @@
 			skb = dev_alloc_skb(pkt_len+5);
 			lp->stats.rx_bytes += pkt_len;
 			if (el3_debug > 4)
-				printk("Receiving packet size %d status %4.4x.\n",
+				printk(KERN_DEBUG "Receiving packet size %d status %4.4x.\n",
 					   pkt_len, rx_status);
 			if (skb != NULL) {
 				skb->dev = dev;
@@ -1054,7 +1054,7 @@
 			outw(RxDiscard, ioaddr + EL3_CMD);
 			lp->stats.rx_dropped++;
 			if (el3_debug)
-				printk("%s: Couldn't allocate a sk_buff of size %d.\n",
+				printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
 					   dev->name, pkt_len);
 		}
 		inw(ioaddr + EL3_STATUS); 				/* Delay. */
@@ -1080,7 +1080,7 @@
 		static int old;
 		if (old != dev->mc_count) {
 			old = dev->mc_count;
-			printk("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
+			printk(KERN_INFO "%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
 		}
 	}
 	spin_lock_irqsave(&lp->lock, flags);
@@ -1103,7 +1103,7 @@
 	struct el3_private *lp = (struct el3_private *)dev->priv;
 	
 	if (el3_debug > 2)
-		printk("%s: Shutting down ethercard.\n", dev->name);
+		printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
 
 	el3_down(dev);
 
@@ -1409,7 +1409,7 @@
 		EL3WINDOW(4);
 		net_diag = inw(ioaddr + WN4_NETDIAG);
 		net_diag = (net_diag | FD_ENABLE); /* temporarily assume full-duplex will be set */
-		printk("%s: ", dev->name);
+		printk(KERN_INFO "%s: ", dev->name);
 		switch (dev->if_port & 0x0c) {
 			case 12:
 				/* force full-duplex mode if 3c5x9b */
@@ -1432,7 +1432,7 @@
 		outw(net_diag, ioaddr + WN4_NETDIAG);
 		printk(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
 		if (el3_debug > 3)
-			printk("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
+			printk(KERN_DEBUG "%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
 		/* Enable link beat and jabber check. */
 		outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA);
 	}

[-- Attachment #1.3: 8390_printk.diff --]
[-- Type: text/plain, Size: 1956 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/8390.c linux-2.5.64-work/drivers/net/8390.c
--- linux-2.5.64/drivers/net/8390.c	2003-03-14 17:37:53.000000000 +0100
+++ linux-2.5.64-work/drivers/net/8390.c	2003-03-14 17:56:05.000000000 +0100
@@ -430,7 +430,7 @@
     
 	if (dev == NULL) 
 	{
-		printk ("net_interrupt(): irq %d for unknown device.\n", irq);
+		printk (KERN_INFO "net_interrupt(): irq %d for unknown device.\n", irq);
 		return;
 	}
     
@@ -448,8 +448,8 @@
 #if 1 /* This might just be an interrupt for a PCI device sharing this line */
 		/* The "irqlock" check is only for testing. */
 		printk(ei_local->irqlock
-			   ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
-			   : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
+			   ? KERN_DEBUG "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
+			   : KERN_DEBUG "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
 			   dev->name, inb_p(e8390_base + EN0_ISR),
 			   inb_p(e8390_base + EN0_IMR));
 #endif
@@ -615,7 +615,7 @@
 	else if (ei_local->tx2 < 0) 
 	{
 		if (ei_local->lasttx != 2  &&  ei_local->lasttx != -2)
-			printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
+			printk(KERN_ERR "%s: bogus last_tx_buffer %d, tx2=%d.\n",
 				ei_local->name, ei_local->lasttx, ei_local->tx2);
 		ei_local->tx2 = 0;
 		if (ei_local->tx1 > 0) 
@@ -782,7 +782,7 @@
 		
 		/* This _should_ never happen: it's here for avoiding bad clones. */
 		if (next_frame >= ei_local->stop_page) {
-			printk("%s: next frame inconsistency, %#2x\n", dev->name,
+			printk(KERN_ERR "%s: next frame inconsistency, %#2x\n", dev->name,
 				   next_frame);
 			next_frame = ei_local->rx_start_page;
 		}
@@ -1008,7 +1008,7 @@
 int ethdev_init(struct net_device *dev)
 {
 	if (ei_debug > 1)
-		printk(version);
+		printk(KERN_DEBUG version);
     
 	if (dev->priv == NULL) 
 	{

[-- Attachment #1.4: slhc_hp_printk.diff --]
[-- Type: text/plain, Size: 3595 bytes --]

diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/hp.c linux-2.5.64-work/drivers/net/hp.c
--- linux-2.5.64/drivers/net/hp.c	2002-11-30 15:07:12.000000000 +0100
+++ linux-2.5.64-work/drivers/net/hp.c	2003-03-14 17:56:05.000000000 +0100
@@ -129,16 +129,16 @@
 	}
 
 	if (ei_debug  &&  version_printed++ == 0)
-		printk(version);
+		printk(KERN_INFO version);
 
 	/* Allocate dev->priv and fill in 8390 specific dev fields. */
 	if (ethdev_init(dev)) {
-		printk (" unable to get memory for dev->priv.\n");
+		printk (KERN_ERR " unable to get memory for dev->priv.\n");
 		retval = -ENOMEM;
 		goto out;
 	}
 
-	printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
+	printk(KERN_NOTICE "%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
 
 	for(i = 0; i < ETHER_ADDR_LEN; i++)
 		printk(" %2.2x", dev->dev_addr[i] = inb(ioaddr + i));
@@ -223,7 +223,7 @@
 	int hp_base = dev->base_addr - NIC_OFFSET;
 	int saved_config = inb_p(hp_base + HP_CONFIGURE);
 
-	if (ei_debug > 1) printk("resetting the 8390 time=%ld...", jiffies);
+	if (ei_debug > 1) printk(KERN_DEBUG "resetting the 8390 time=%ld...", jiffies);
 	outb_p(0x00, hp_base + HP_CONFIGURE);
 	ei_status.txing = 0;
 	/* Pause just a few cycles for the hardware reset to take place. */
@@ -235,7 +235,7 @@
 	if ((inb_p(hp_base+NIC_OFFSET+EN0_ISR) & ENISR_RESET) == 0)
 		printk("%s: hp_reset_8390() did not complete.\n", dev->name);
 
-	if (ei_debug > 1) printk("8390 reset done (%ld).", jiffies);
+	if (ei_debug > 1) printk("8390 reset done (%ld).\n", jiffies);
 	return;
 }
 
@@ -295,7 +295,7 @@
 	  int addr = (high << 8) + low;
 	  /* Check only the lower 8 bits so we can ignore ring wrap. */
 	  if (((ring_offset + xfer_count) & 0xff) != (addr & 0xff))
-		printk("%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
+		printk(KERN_WARNING "%s: RX transfer address mismatch, %#4.4x vs. %#4.4x (actual).\n",
 			   dev->name, ring_offset + xfer_count, addr);
 	}
 	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
@@ -352,7 +352,7 @@
 	  int low  = inb_p(nic_base + EN0_RSARLO);
 	  int addr = (high << 8) + low;
 	  if ((start_page << 8) + count != addr)
-		printk("%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
+		printk(KERN_WARNING "%s: TX Transfer address mismatch, %#4.4x vs. %#4.4x.\n",
 			   dev->name, (start_page << 8) + count, addr);
 	}
 	outb_p(saved_config & (~HP_DATAON), nic_base - NIC_OFFSET + HP_CONFIGURE);
diff -urN -X /home/venza/kernel/dontdiff linux-2.5.64/drivers/net/slhc.c linux-2.5.64-work/drivers/net/slhc.c
--- linux-2.5.64/drivers/net/slhc.c	2003-03-14 17:37:55.000000000 +0100
+++ linux-2.5.64-work/drivers/net/slhc.c	2003-03-14 17:56:05.000000000 +0100
@@ -696,7 +696,7 @@
 void slhc_i_status(struct slcompress *comp)
 {
 	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d Bad, %d Tossed\n",
+		printk(KERN_INFO "\t%d Cmp, %d Uncmp, %d Bad, %d Tossed\n",
 			comp->sls_i_compressed,
 			comp->sls_i_uncompressed,
 			comp->sls_i_error,
@@ -708,12 +708,12 @@
 void slhc_o_status(struct slcompress *comp)
 {
 	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
+		printk(KERN_INFO "\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
 			comp->sls_o_compressed,
 			comp->sls_o_uncompressed,
 			comp->sls_o_tcp,
 			comp->sls_o_nontcp);
-		printk("\t%10d Searches, %10d Misses\n",
+		printk(KERN_INFO "\t%10d Searches, %10d Misses\n",
 			comp->sls_o_searches,
 			comp->sls_o_misses);
 	}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2003-03-14 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-13 16:41 [PATCH] add prink KERN_* suffixes Daniele Venzano
2003-03-13 17:22 ` Andreas Schwab
2003-03-13 21:43 ` Robert Love
2003-03-14 18:45   ` Daniele Venzano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox