[svn-commits] sruffell: linux/trunk r8006 - /linux/trunk/drivers/dahdi/wcte12xp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 8 16:49:40 CST 2010


Author: sruffell
Date: Mon Feb  8 16:49:34 2010
New Revision: 8006

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8006
Log:
wcte12xp: Identify the card that is printing to the kernel log.

Drops all users of module_printk in order to use 't1_info', which is a wrapper
for dev_info.  Also updates debug_printk to also print the bus location
information.

Modified:
    linux/trunk/drivers/dahdi/wcte12xp/base.c
    linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8006&r1=8005&r2=8006
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Mon Feb  8 16:49:34 2010
@@ -339,15 +339,16 @@
 	portconfig.EightSlotMask3 = 0x0000;
 
 	if ((configportstatus = gpakConfigurePorts(vpm->dspid, &portconfig, &pstatus))) {
-		printk(KERN_NOTICE "Configuration of ports failed (%d)!\n", configportstatus);
+		t1_info(wc, "Configuration of ports failed (%d)!\n",
+			configportstatus);
 		return -1;
 	} else {
 		if (vpm->options.debug & DEBUG_ECHOCAN)
-			printk(KERN_DEBUG "Configured McBSP ports successfully\n");
+			t1_info(wc, "Configured McBSP ports successfully\n");
 	}
 
 	if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
-		printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+		t1_info(wc, "Error pinging DSP (%d)\n", res);
 		return -1;
 	}
 
@@ -362,22 +363,25 @@
 
 		vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
 		if ((res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus))) {
-			printk(KERN_NOTICE "Unable to configure channel #%d (%d)", channel, res);
+			t1_info(wc, "Unable to configure channel #%d (%d)",
+				channel, res);
 			if (res == 1) {
-				printk(", reason %d", cstatus);
-			}
-			printk("\n");
+				printk(KERN_CONT ", reason %d", cstatus);
+			}
+			printk(KERN_CONT "\n");
 			return -1;
 		}
 
 		if ((res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &algstatus))) {
-			printk(KERN_NOTICE "Unable to disable echo can on channel %d (reason %d:%d)\n", channel + 1, res, algstatus);
+			t1_info(wc, "Unable to disable echo can on channel %d "
+				"(reason %d:%d)\n", channel + 1, res,
+				algstatus);
 			return -1;
 		}
 	}
 
 	if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
-		printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+		t1_info(wc, "Error pinging DSP (%d)\n", res);
 		return -1;
 	}
 
@@ -385,6 +389,9 @@
 
 	return 0;
 }
+
+#define debug_printk(wc, lvl, fmt, args...) if (debug >= (lvl)) do { \
+	t1_info((wc), fmt , ## args); } while (0)
 
 static void cmd_dequeue_vpmadt032(struct t1 *wc, unsigned char *writechunk, int whichframe)
 {
@@ -397,7 +404,7 @@
 	writechunk += 66;
 
 	if (test_bit(VPM150M_SPIRESET, &vpm->control) || test_bit(VPM150M_HPIRESET, &vpm->control)) {
-		debug_printk(1, "HW Resetting VPMADT032 ...\n");
+		debug_printk(wc, 1, "HW Resetting VPMADT032 ...\n");
 		for (x = 0; x < 4; x++) {
 			if (!x) {
 				if (test_and_clear_bit(VPM150M_SPIRESET, &vpm->control))
@@ -526,7 +533,9 @@
 	for (x = 0; x < 7; x++) {
 		for (y = 0; y < 3; y++) {
 			if (writechunk[CMD_BYTE(x, y, 1)] & 0x2) {
-				module_printk("the test bit is high for byte %d\n", y);
+				t1_info(wc,
+					"the test bit is high for byte %d\n",
+					y);
 			}
 		}
 	}
@@ -636,8 +645,10 @@
 		    ((channo < 0) ||    /* channo=-1 means all channels */ 
 		     (j == (channo-1)/8) )) { /* only the register for this channo */    
 			ret = t1_setreg(wc, 0x2f + j, val);
-			if (ret < 0)
-				module_printk("set_clear failed for chan %d!\n",i); 
+			if (ret < 0) {
+				t1_info(wc, "set_clear failed for chan %d!\n",
+					i);
+			}
 			val = 0;
 		}
 	}
@@ -670,14 +681,15 @@
 static void t1_release(struct t1 *wc)
 {
 	dahdi_unregister(&wc->span);
-	printk(KERN_INFO "Freed a Wildcard TE12xP.\n");
+	t1_info(wc, "Freed a Wildcard TE12xP.\n");
 	free_wc(wc);
 }
 
 static void t4_serial_setup(struct t1 *wc)
 {
-	module_printk("Setting up global serial parameters for %s\n", 
-		      wc->spantype == TYPE_E1 ? (unchannelized ? "Unchannelized E1" : "E1") : "T1");
+	t1_info(wc, "Setting up global serial parameters for %s\n",
+		wc->spantype == TYPE_E1 ?
+		(unchannelized ? "Unchannelized E1" : "E1") : "T1");
 
 	t1_setreg(wc, 0x85, 0xe0);	/* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */
 	t1_setreg(wc, 0x08, 0x05);	/* IPC: Interrupt push/pull active low */
@@ -799,7 +811,7 @@
 		break;
 	}
 
-	module_printk("Span configured for %s/%s\n", framing, line);
+	t1_info(wc, "Span configured for %s/%s\n", framing, line);
 }
 
 static void t1_configure_e1(struct t1 *wc, int lineconfig)
@@ -877,7 +889,8 @@
 	t1_setreg(wc, 0x26, 0x54);	/* XPM0 */
 	t1_setreg(wc, 0x27, 0x02);	/* XPM1 */
 	t1_setreg(wc, 0x28, 0x00);	/* XPM2 */
-	module_printk("Span configured for %s/%s%s\n", framing, line, crc4);
+
+	t1_info(wc, "Span configured for %s/%s%s\n", framing, line, crc4);
 }
 
 static void t1xxp_framer_start(struct t1 *wc, struct dahdi_span *span)
@@ -905,7 +918,7 @@
 
 	/* Reset framer with proper parameters and start */
 	t1xxp_framer_start(wc, span);
-	debug_printk(1, "Calling startup (flags is %lu)\n", span->flags);
+	debug_printk(wc, 1, "Calling startup (flags is %lu)\n", span->flags);
 
 	return 0;
 }
@@ -955,7 +968,8 @@
 	struct t1 *wc = chan->pvt;
 	unsigned long flags;
 	
-	debug_printk(2, "Setting bits to %d on channel %s\n", bits, chan->name);
+	debug_printk(wc, 2, "Setting bits to %d on channel %s\n",
+		     bits, chan->name);
 	if (wc->spantype == TYPE_E1) { /* do it E1 way */
 		if (chan->chanpos == 16)
 			return 0;
@@ -998,7 +1012,7 @@
 		  /* output them to the chip */
 		t1_setreg(wc, 0x70 + b, c);
 	} 
-	debug_printk(2,"Finished setting RBS bits\n");
+	debug_printk(wc, 2, "Finished setting RBS bits\n");
 
 	return 0;
 }
@@ -1088,37 +1102,40 @@
 	if (wc->spantype == TYPE_E1) {
 		switch (cmd) {
 		case DAHDI_MAINT_NONE:
-			module_printk("XXX Turn off local and remote loops E1 XXX\n");
+			t1_info(wc, "XXX Turn off local and remote "
+				"loops E1 XXX\n");
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
-			module_printk("XXX Turn on local loopback E1 XXX\n");
+			t1_info(wc, "XXX Turn on local loopback E1 XXX\n");
 			break;
 		case DAHDI_MAINT_REMOTELOOP:
-			module_printk("XXX Turn on remote loopback E1 XXX\n");
+			t1_info(wc, "XXX Turn on remote loopback E1 XXX\n");
 			break;
 		case DAHDI_MAINT_LOOPUP:
-			module_printk("XXX Send loopup code E1 XXX\n");
+			t1_info(wc, "XXX Send loopup code E1 XXX\n");
 			break;
 		case DAHDI_MAINT_LOOPDOWN:
-			module_printk("XXX Send loopdown code E1 XXX\n");
+			t1_info(wc, "XXX Send loopdown code E1 XXX\n");
 			break;
 		case DAHDI_MAINT_LOOPSTOP:
-			module_printk("XXX Stop sending loop codes E1 XXX\n");
+			t1_info(wc, "XXX Stop sending loop codes E1 XXX\n");
 			break;
 		default:
-			module_printk("Unknown E1 maint command: %d\n", cmd);
+			t1_info(wc, "Unknown E1 maint command: %d\n", cmd);
 			break;
 		}
 	} else {
 		switch (cmd) {
 		case DAHDI_MAINT_NONE:
-			module_printk("XXX Turn off local and remote loops T1 XXX\n");
+			t1_info(wc, "XXX Turn off local and remote "
+				"loops T1 XXX\n");
 			break;
 		case DAHDI_MAINT_LOCALLOOP:
-			module_printk("XXX Turn on local loop and no remote loop XXX\n");
+			t1_info(wc, "XXX Turn on local loop and no remote "
+				"loop XXX\n");
 			break;
 		case DAHDI_MAINT_REMOTELOOP:
-			module_printk("XXX Turn on remote loopup XXX\n");
+			t1_info(wc, "XXX Turn on remote loopup XXX\n");
 			break;
 		case DAHDI_MAINT_LOOPUP:
 			t1_setreg(wc, 0x21, 0x50);	/* FMR5: Nothing but RBS mode */
@@ -1130,7 +1147,7 @@
 			t1_setreg(wc, 0x21, 0x40);	/* FMR5: Nothing but RBS mode */
 			break;
 		default:
-			module_printk("Unknown T1 maint command: %d\n", cmd);
+			t1_info(wc, "Unknown T1 maint command: %d\n", cmd);
 			break;
 		}
 	}
@@ -1209,7 +1226,7 @@
 	/* Find position */
 	for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) {
 		if (ifaces[x] == wc) {
-			debug_printk(1, "software init for card %d\n",x);
+			debug_printk(wc, 1, "software init for card %d\n", x);
 			break;
 		}
 	}
@@ -1273,7 +1290,7 @@
 		wc->chans[x]->chanpos = x + 1;
 	}
 	if (dahdi_register(&wc->span, 0)) {
-		module_printk("Unable to register span with DAHDI\n");
+		t1_info(wc, "Unable to register span with DAHDI\n");
 		return -1;
 	}
 
@@ -1360,19 +1377,19 @@
 		else	
 			wc->spantype = TYPE_E1;
 	}
-	debug_printk(1, "spantype: %s\n", wc->spantype==1 ? "T1" : "E1");
+	debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
 	
 	/* what version of the FALC are we using? */
 	reg = t1_setreg(wc, 0x4a, 0xaa);
 	reg = t1_getreg(wc, 0x4a);
-	debug_printk(1, "FALC version: %08x\n", reg);
+	debug_printk(wc, 1, "FALC version: %08x\n", reg);
 
 	/* make sure reads and writes work */
 	for (x = 0; x < 256; x++) {
 		t1_setreg(wc, 0x14, x);
 		reg = t1_getreg(wc, 0x14);
 		if (reg != x)
-			module_printk("Wrote '%x' but read '%x'\n", x, reg);
+			t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
 	}
 
 	t1_setleds(wc, wc->ledstate);
@@ -1402,14 +1419,15 @@
 		config_vpmadt032(wc->vpmadt032, wc);
 
 		set_span_devicetype(wc);
-		module_printk("VPM present and operational (Firmware version %x)\n", wc->vpmadt032->version);
+		t1_info(wc, "VPM present and operational "
+			"(Firmware version %x)\n", wc->vpmadt032->version);
 		wc->ctlreg |= 0x10; /* turn on vpm (RX audio from vpm module) */
 		if (vpmtsisupport) {
-			debug_printk(1, "enabling VPM TSI pin\n");
+			debug_printk(wc, 1, "enabling VPM TSI pin\n");
 			wc->ctlreg |= 0x01; /* turn on vpm timeslot interchange pin */
 		}
 	} else {
-		module_printk("VPM Support Disabled\n");
+		t1_info(wc, "VPM Support Disabled\n");
 		wc->vpmadt032 = NULL;
 	}
 #endif
@@ -1444,7 +1462,7 @@
 			if (!wc->flags.nmf) {
 				t1_setreg(wc, 0x20, 0x9f | 0x20);	/* LIM0: Force RAI High */
 				wc->flags.nmf = 1;
-				module_printk("NMF workaround on!\n");
+				t1_info(wc, "NMF workaround on!\n");
 			}
 			t1_setreg(wc, 0x1e, 0xc3);	/* Reset to CRC4 mode */
 			t1_setreg(wc, 0x1c, 0xf2);	/* Force Resync */
@@ -1453,7 +1471,7 @@
 			if (wc->flags.nmf) {
 				t1_setreg(wc, 0x20, 0x9f);	/* LIM0: Clear forced RAI */
 				wc->flags.nmf = 0;
-				module_printk("NMF workaround off!\n");
+				t1_info(wc, "NMF workaround off!\n");
 			}
 		}
 	} else {
@@ -1539,13 +1557,13 @@
 
 	/* If receiving alarms, go into Yellow alarm state */
 	if (alarms && !wc->flags.sendingyellow) {
-		module_printk("Setting yellow alarm\n");
+		t1_info(wc, "Setting yellow alarm\n");
 
 		/* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */
 		t1_setreg(wc, 0x20, fmr4 | 0x20);
 		wc->flags.sendingyellow = 1;
 	} else if (!alarms && wc->flags.sendingyellow) {
-		module_printk("Clearing yellow alarm\n");
+		t1_info(wc, "Clearing yellow alarm\n");
 		/* We manually do yellow alarm to handle RECOVER  */
 		t1_setreg(wc, 0x20, fmr4 & ~0x20);
 		wc->flags.sendingyellow = 0;
@@ -1683,8 +1701,11 @@
 			if (wc->rxident != expected) {
 				wc->span.irqmisses++;
 				resend_cmds(wc);
-				if (unlikely(debug && test_bit(INITIALIZED, &wc->bit_flags)))
-					module_printk("oops: rxident=%d expected=%d x=%d\n", wc->rxident, expected, x);
+				if (unlikely(debug)) {
+					t1_info(wc, "oops: rxident=%d "
+						"expected=%d x=%d\n",
+						wc->rxident, expected, x);
+				}
 			}
 		}
 		cmd_decipher(wc, readchunk);
@@ -1772,7 +1793,8 @@
 	}
 
 	if (-1 == index) {
-		module_printk("Too many interfaces\n");
+		printk(KERN_INFO "%s: Too many interfaces\n",
+		       THIS_MODULE->name);
 		return -EIO;
 	}
 	
@@ -1843,7 +1865,7 @@
 
 	mod_timer(&wc->timer, jiffies + HZ/5);
 	t1_software_init(wc);
-	module_printk("Found a %s\n", wc->variety);
+	t1_info(wc, "Found a %s\n", wc->variety);
 	voicebus_unlock_latency(&wc->vb);
 	return 0;
 }

Modified: linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=8006&r1=8005&r2=8006
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h Mon Feb  8 16:49:34 2010
@@ -77,8 +77,6 @@
 #define TYPE_T1	1
 #define TYPE_E1	2
 
-#define module_printk(fmt, args...) printk(KERN_INFO "%s: " fmt, THIS_MODULE->name, ## args)
-#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
 extern spinlock_t ifacelock;
 
 struct command {




More information about the svn-commits mailing list