[dahdi-commits] kpfleming: branch linux/kpfleming/modular_ec r4434 - /linux/team/kpfleming/mo...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Jun 20 17:34:04 CDT 2008


Author: kpfleming
Date: Fri Jun 20 17:34:04 2008
New Revision: 4434

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4434
Log:
add /proc/dahdi reporting of attached echocan for each channel

convert dahdi-base to use module_printk() for messages

fix constructed module name when attempting to autoload dynamic span drivers


Modified:
    linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c
    linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_dynamic.c

Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c?view=diff&rev=4434&r1=4433&r2=4434
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c Fri Jun 20 17:34:04 2008
@@ -594,11 +594,16 @@
 					len += sprintf(page + len, "(In use) ");
 				}
 #ifdef	OPTIMIZE_CHANMUTE
-				if ((chans[x]->chanmute)) {
+				if (chans[x]->chanmute) {
 					len += sprintf(page + len, "(no pcm) ");
 				}
 #endif
 				len += fill_alarm_string(page + len, count - len, chans[x]->chan_alarms);
+
+				if (chans[x]->ec_factory) {
+					len += sprintf(page + len, " (EC: %s) ", chans[x]->ec_factory->name);
+				}
+
 				len += sprintf(page + len, "\n");
 			}
 			if (len <= off) { /* If everything printed so far is before beginning of request */
@@ -988,6 +993,7 @@
 	const char *d;
 	char modname_buf[128] = "dahdi_echocan_";
 	unsigned int tried_once = 0;
+	int res;
 
 	for (c = name_upper, d = name; *d; c++, d++) {
 		*c = toupper(*d);
@@ -1000,7 +1006,7 @@
 
 	list_for_each_entry(cur, &echocan_list, list) {
 		if (!strcmp(name_upper, cur->ec->name)) {
-			if (try_module_get(cur->owner)) {
+			if ((res = try_module_get(cur->owner))) {
 				read_unlock(&echocan_list_lock);
 				return cur->ec;
 			} else {
@@ -1185,7 +1191,7 @@
 	write_unlock(&zone_lock);
 
 	if (!res)
-		printk(KERN_INFO "Registered tone zone %d (%s)\n", num, zone->name);
+		module_printk(KERN_INFO, "Registered tone zone %d (%s)\n", num, zone->name);
 
 	return res;
 }
@@ -1209,7 +1215,7 @@
 		if (__warnonce) {
 			__warnonce = 0;
 			/* The tonezones are loaded by ztcfg based on /etc/dahdi.conf. */
-			printk(KERN_WARNING "DAHDI: Cannot start tones until tone zone is loaded.\n");
+			module_printk(KERN_WARNING, "DAHDI: Cannot start tones until tone zone is loaded.\n");
 		}
 		/* Note that no tone zone exists at the moment */
 		res = -ENODATA;
@@ -1385,7 +1391,7 @@
 	}
 	write_unlock_irqrestore(&chan_lock, flags);	
 	if (x >= DAHDI_MAX_CHANNELS)
-		printk(KERN_ERR "No more channels available\n");
+		module_printk(KERN_ERR, "No more channels available\n");
 	return res;
 }
 
@@ -1416,15 +1422,15 @@
 	int res;
 #endif
 	if (!ms) {
-		printk("dahdi_net_open: nothing??\n");
+		module_printk(KERN_NOTICE, "dahdi_net_open: nothing??\n");
 		return -EINVAL;
 	}
 	if (test_bit(DAHDI_FLAGBIT_OPEN, &ms->flags)) {
-		printk("%s is already open!\n", ms->name);
+		module_printk(KERN_NOTICE, "%s is already open!\n", ms->name);
 		return -EBUSY;
 	}
 	if (!(ms->flags & DAHDI_FLAG_NETDEV)) {
-		printk("%s is not a net device!\n", ms->name);
+		module_printk(KERN_NOTICE, "%s is not a net device!\n", ms->name);
 		return -EINVAL;
 	}
 	ms->txbufpolicy = DAHDI_POLICY_IMMEDIATE;
@@ -1441,7 +1447,7 @@
 	netif_start_queue(ztchan_to_dev(ms));
 
 #ifdef CONFIG_DAHDI_DEBUG
-	printk("DAHDINET: Opened channel %d name %s\n", ms->channo, ms->name);
+	module_printk(KERN_NOTICE, "DAHDINET: Opened channel %d name %s\n", ms->channo, ms->name);
 #endif
 	return 0;
 }
@@ -1477,19 +1483,19 @@
 	struct dahdi_chan *ms = hdlc_to_ztchan(hdlc);
 	if (!ms) {
 #ifdef NEW_HDLC_INTERFACE
-		printk("dahdi_net_stop: nothing??\n");
+		module_printk(KERN_NOTICE, "dahdi_net_stop: nothing??\n");
 		return 0;
 #else
-		printk("dahdi_net_close: nothing??\n");
+		module_printk(KERN_NOTICE, "dahdi_net_close: nothing??\n");
 		return;
 #endif
 	}
 	if (!(ms->flags & DAHDI_FLAG_NETDEV)) {
 #ifdef NEW_HDLC_INTERFACE
-		printk("dahdi_net_stop: %s is not a net device!\n", ms->name);
+		module_printk(KERN_NOTICE, "dahdi_net_stop: %s is not a net device!\n", ms->name);
 		return 0;
 #else
-		printk("dahdi_net_close: %s is not a net device!\n", ms->name);
+		module_printk(KERN_NOTICE, "dahdi_net_close: %s is not a net device!\n", ms->name);
 		return;
 #endif
 	}
@@ -1567,7 +1573,7 @@
 	/* See if we have any buffers */
 	spin_lock_irqsave(&ss->lock, flags);
 	if (skb->len > ss->blocksize - 2) {
-		printk(KERN_ERR "dahdi_xmit(%s): skb is too large (%d > %d)\n", dev->name, skb->len, ss->blocksize -2);
+		module_printk(KERN_ERR, "dahdi_xmit(%s): skb is too large (%d > %d)\n", dev->name, skb->len, ss->blocksize -2);
 		stats->tx_dropped++;
 		retval = 0;
 	} else if (ss->inwritebuf >= 0) {
@@ -1605,7 +1611,7 @@
 		stats->tx_packets++;
 		stats->tx_bytes += ss->writen[oldbuf];
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("Buffered %d bytes to go out in buffer %d\n", ss->writen[oldbuf], oldbuf);
+		module_printk(KERN_NOTICE, "Buffered %d bytes to go out in buffer %d\n", ss->writen[oldbuf], oldbuf);
 		for (x=0;x<ss->writen[oldbuf];x++)
 		     printk("%02x ", ss->writebuf[oldbuf][x]);
 		printk("\n");
@@ -1652,10 +1658,10 @@
 	/* See if we have any buffers */
 	spin_lock_irqsave(&ss->lock, flags);
 	if (!(test_bit(DAHDI_FLAGBIT_OPEN, &ss->flags))) {
-		printk("Can't transmit on closed channel\n");
+		module_printk(KERN_ERR, "Can't transmit on closed channel\n");
 		retval = 1;
 	} else if (skb->len > ss->blocksize - 4) {
-		printk(KERN_ERR "dahdi_ppp_xmit(%s): skb is too large (%d > %d)\n", ss->name, skb->len, ss->blocksize -2);
+		module_printk(KERN_ERR, "dahdi_ppp_xmit(%s): skb is too large (%d > %d)\n", ss->name, skb->len, ss->blocksize -2);
 		retval = 1;
 	} else if (ss->inwritebuf >= 0) {
 		/* We have a place to put this packet */
@@ -1706,7 +1712,7 @@
 			ss->outwritebuf = oldbuf;
 		}
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("Buffered %d bytes (skblen = %d) to go out in buffer %d\n", ss->writen[oldbuf], skb->len, oldbuf);
+		module_printk(KERN_NOTICE, "Buffered %d bytes (skblen = %d) to go out in buffer %d\n", ss->writen[oldbuf], skb->len, oldbuf);
 		for (x=0;x<ss->writen[oldbuf];x++)
 		     printk("%02x ", ss->writebuf[oldbuf][x]);
 		printk("\n");
@@ -1755,7 +1761,7 @@
 	}
 #ifdef CONFIG_DAHDI_PPP
 	if (chan->ppp) {
-		printk("HUH???  PPP still attached??\n");
+		module_printk(KERN_NOTICE, "HUH???  PPP still attached??\n");
 	}
 #endif
 	maxchans = 0;
@@ -1828,8 +1834,8 @@
 		int x;
 		if (amnt > chan->readn[res])
 			myamnt = chan->readn[res];
-		printk("dahdi_chan_read(unit: %d, inwritebuf: %d, outwritebuf: %d amnt: %d\n", 
-			unit, chan->inwritebuf, chan->outwritebuf, myamnt);
+		module_printk(KERN_NOTICE, "dahdi_chan_read(unit: %d, inwritebuf: %d, outwritebuf: %d amnt: %d\n", 
+			      unit, chan->inwritebuf, chan->outwritebuf, myamnt);
 		printk("\t("); for (x = 0; x < myamnt; x++) printk((x ? " %02x" : "%02x"), (unsigned char)usrbuf[x]);
 		printk(")\n");
 	}
@@ -1931,14 +1937,14 @@
 	}
 
 #ifdef CONFIG_DAHDI_DEBUG
-	printk("dahdi_chan_write(unit: %d, res: %d, outwritebuf: %d amnt: %d\n",
-		unit, chan->res, chan->outwritebuf, amnt);
+	module_printk(KERN_NOTICE, "dahdi_chan_write(unit: %d, res: %d, outwritebuf: %d amnt: %d\n",
+		      unit, chan->res, chan->outwritebuf, amnt);
 #endif
 #if 0
  	if ((unit == 24) || (unit == 48) || (unit == 16) || (unit == 47)) { 
  		int x;
- 		printk("dahdi_chan_write/in(unit: %d, res: %d, outwritebuf: %d amnt: %d, txdisable: %d)\n",
- 			unit, res, chan->outwritebuf, amnt, chan->txdisable);
+ 		module_printk(KERN_NOTICE, "dahdi_chan_write/in(unit: %d, res: %d, outwritebuf: %d amnt: %d, txdisable: %d)\n",
+			      unit, res, chan->outwritebuf, amnt, chan->txdisable);
  		printk("\t("); for (x = 0; x < amnt; x++) printk((x ? " %02x" : "%02x"), (unsigned char)usrbuf[x]);
  		printk(")\n");
  	}
@@ -2071,15 +2077,15 @@
 	/* if no span, return doing nothing */
 	if (!chan->span) return;
 	if (!chan->span->flags & DAHDI_FLAG_RBS) {
-		printk("dahdi_rbs: Tried to set RBS hook state on non-RBS channel %s\n", chan->name);
+		module_printk(KERN_NOTICE, "dahdi_rbs: Tried to set RBS hook state on non-RBS channel %s\n", chan->name);
 		return;
 	}
 	if ((txsig > 3) || (txsig < 0)) {
-		printk("dahdi_rbs: Tried to set RBS hook state %d (> 3) on  channel %s\n", txsig, chan->name);
+		module_printk(KERN_NOTICE, "dahdi_rbs: Tried to set RBS hook state %d (> 3) on  channel %s\n", txsig, chan->name);
 		return;
 	}
 	if (!chan->span->rbsbits && !chan->span->hooksig) {
-		printk("dahdi_rbs: Tried to set RBS hook state %d on channel %s while span %s lacks rbsbits or hooksig function\n",
+		module_printk(KERN_NOTICE, "dahdi_rbs: Tried to set RBS hook state %d on channel %s while span %s lacks rbsbits or hooksig function\n",
 			txsig, chan->name, chan->span->name);
 		return;
 	}
@@ -2118,7 +2124,7 @@
 		for (x=0;x<NUM_SIGS;x++) {
 			if (outs[x][0] == chan->sig) {
 #ifdef CONFIG_DAHDI_DEBUG
-				printk("Setting bits to %d for channel %s state %d in %d signalling\n", outs[x][txsig + 1], chan->name, txsig, chan->sig);
+				module_printk(KERN_NOTICE, "Setting bits to %d for channel %s state %d in %d signalling\n", outs[x][txsig + 1], chan->name, txsig, chan->sig);
 #endif
 				chan->txhooksig = txsig;
 				chan->txsig = outs[x][txsig+1];
@@ -2128,7 +2134,7 @@
 			}
 		}
 	}
-	printk("dahdi_rbs: Don't know RBS signalling type %d on channel %s\n", chan->sig, chan->name);
+	module_printk(KERN_NOTICE, "dahdi_rbs: Don't know RBS signalling type %d on channel %s\n", chan->sig, chan->name);
 }
 
 static int dahdi_cas_setbits(struct dahdi_chan *chan, int bits)
@@ -2139,7 +2145,7 @@
 		chan->txsig = bits;
 		chan->span->rbsbits(chan, bits);
 	} else {
-		printk("Huh?  CAS setbits, but no RBS bits function\n");
+		module_printk(KERN_NOTICE, "Huh?  CAS setbits, but no RBS bits function\n");
 	}
 	return 0;
 }
@@ -2382,7 +2388,7 @@
 		}
 		spin_unlock_irqrestore(&zaptimerlock, flags);
 		if (!cur) {
-			printk("DAHDI Timer: Not on list??\n");
+			module_printk(KERN_NOTICE, "Timer: Not on list??\n");
 			return 0;
 		}
 		kfree(t);
@@ -2575,7 +2581,7 @@
 	if (unit == 255) {
 		chan = file->private_data;
 		if (!chan) {
-			printk("No pseudo channel structure to read?\n");
+			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			return -EINVAL;
 		}
 		return dahdi_chan_read(file, usrbuf, count, chan->channo);
@@ -2606,7 +2612,7 @@
 	if (unit == 255) {
 		chan = file->private_data;
 		if (!chan) {
-			printk("No pseudo channel structure to read?\n");
+			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			return -EINVAL;
 		}
 		return dahdi_chan_write(file, usrbuf, count, chan->channo);
@@ -2663,7 +2669,7 @@
 	data += sizeof(th);
 
 	if ((th.count < 0) || (th.count > MAX_TONES)) {
-		printk("Too many tones included\n");
+		module_printk(KERN_NOTICE, "Too many tones included\n");
 		return -EINVAL;
 	}
 
@@ -2698,7 +2704,7 @@
 
 		if (space < sizeof(*t)) {
 			kfree(slab);
-			printk("Insufficient tone zone space\n");
+			module_printk(KERN_NOTICE, "Insufficient tone zone space\n");
 			return -EINVAL;
 		}
 
@@ -2722,7 +2728,7 @@
 			
 			/* Make sure the "next" one is sane */
 			if ((next[x] >= th.count) || (next[x] < 0)) {
-				printk("Invalid 'next' pointer: %d\n", next[x]);
+				module_printk(KERN_NOTICE, "Invalid 'next' pointer: %d\n", next[x]);
 				kfree(slab);
 				return -EINVAL;
 			}
@@ -2747,7 +2753,7 @@
 			td.tone -= DAHDI_TONE_MFR2_REV_BASE;
 			t = &z->mfr2_rev[td.tone];
 		} else {
-			printk("Invalid tone (%d) defined\n", td.tone);
+			module_printk(KERN_NOTICE, "Invalid tone (%d) defined\n", td.tone);
 			kfree(slab);
 			return -EINVAL;
 		}
@@ -2839,7 +2845,7 @@
 		if (__warnonce) {
 			__warnonce = 0;
 			/* The tonezones are loaded by ztcfg based on /etc/dahdi.conf. */
-			printk(KERN_WARNING "DAHDI: Cannot get dtmf tone until tone zone is loaded.\n");
+			module_printk(KERN_WARNING, "Cannot get dtmf tone until tone zone is loaded.\n");
 		}
 		return NULL;
 	}
@@ -3056,7 +3062,7 @@
 			res = dahdi_specchan_release(inode, file, chan->channo);
 			dahdi_free_pseudo(chan);
 		} else {
-			printk("Pseudo release and no private data??\n");
+			module_printk(KERN_NOTICE, "Pseudo release and no private data??\n");
 			res = 0;
 		}
 		return res;
@@ -3110,7 +3116,7 @@
 		for (x=1; x<maxspans; x++) {
 			if (spans[x] && !spans[x]->alarms && (spans[x]->flags & DAHDI_FLAG_RUNNING)) {
 				if(master != spans[x])
-					printk("DAHDI: Master changed to %s\n", spans[x]->name);
+					module_printk(KERN_NOTICE, "Master changed to %s\n", spans[x]->name);
 				master = spans[x];
 				break;
 			}
@@ -3455,39 +3461,39 @@
 		/* release it. */
 		spin_unlock_irqrestore(&chans[j]->lock, flags);
 
-		printk(KERN_INFO "Dump of DAHDI Channel %d (%s,%d,%d):\n\n",j,
+		module_printk(KERN_INFO, "Dump of DAHDI Channel %d (%s,%d,%d):\n\n",j,
 			mychan->name,mychan->channo,mychan->chanpos);
-		printk(KERN_INFO "flags: %x hex, writechunk: %08lx, readchunk: %08lx\n",
+		module_printk(KERN_INFO, "flags: %x hex, writechunk: %08lx, readchunk: %08lx\n",
 			(unsigned int) mychan->flags, (long) mychan->writechunk, (long) mychan->readchunk);
-		printk(KERN_INFO "rxgain: %08lx, txgain: %08lx, gainalloc: %d\n",
+		module_printk(KERN_INFO, "rxgain: %08lx, txgain: %08lx, gainalloc: %d\n",
 			(long) mychan->rxgain, (long)mychan->txgain, mychan->gainalloc);
-		printk(KERN_INFO "span: %08lx, sig: %x hex, sigcap: %x hex\n",
+		module_printk(KERN_INFO, "span: %08lx, sig: %x hex, sigcap: %x hex\n",
 			(long)mychan->span, mychan->sig, mychan->sigcap);
-		printk(KERN_INFO "inreadbuf: %d, outreadbuf: %d, inwritebuf: %d, outwritebuf: %d\n",
+		module_printk(KERN_INFO, "inreadbuf: %d, outreadbuf: %d, inwritebuf: %d, outwritebuf: %d\n",
 			mychan->inreadbuf, mychan->outreadbuf, mychan->inwritebuf, mychan->outwritebuf);
-		printk(KERN_INFO "blocksize: %d, numbufs: %d, txbufpolicy: %d, txbufpolicy: %d\n",
+		module_printk(KERN_INFO, "blocksize: %d, numbufs: %d, txbufpolicy: %d, txbufpolicy: %d\n",
 			mychan->blocksize, mychan->numbufs, mychan->txbufpolicy, mychan->rxbufpolicy);
-		printk(KERN_INFO "txdisable: %d, rxdisable: %d, iomask: %d\n",
+		module_printk(KERN_INFO, "txdisable: %d, rxdisable: %d, iomask: %d\n",
 			mychan->txdisable, mychan->rxdisable, mychan->iomask);
-		printk(KERN_INFO "curzone: %08lx, tonezone: %d, curtone: %08lx, tonep: %d\n",
+		module_printk(KERN_INFO, "curzone: %08lx, tonezone: %d, curtone: %08lx, tonep: %d\n",
 			(long) mychan->curzone, mychan->tonezone, (long) mychan->curtone, mychan->tonep);
-		printk(KERN_INFO "digitmode: %d, txdialbuf: %s, dialing: %d, aftdialtimer: %d, cadpos. %d\n",
+		module_printk(KERN_INFO, "digitmode: %d, txdialbuf: %s, dialing: %d, aftdialtimer: %d, cadpos. %d\n",
 			mychan->digitmode, mychan->txdialbuf, mychan->dialing,
 				mychan->afterdialingtimer, mychan->cadencepos);
-		printk(KERN_INFO "confna: %d, confn: %d, confmode: %d, confmute: %d\n",
+		module_printk(KERN_INFO, "confna: %d, confn: %d, confmode: %d, confmute: %d\n",
 			mychan->confna, mychan->_confn, mychan->confmode, mychan->confmute);
-		printk(KERN_INFO "ec: %08lx, echocancel: %d, deflaw: %d, xlaw: %08lx\n",
+		module_printk(KERN_INFO, "ec: %08lx, echocancel: %d, deflaw: %d, xlaw: %08lx\n",
 			(long) mychan->ec_state, mychan->echocancel, mychan->deflaw, (long) mychan->xlaw);
-		printk(KERN_INFO "echostate: %02x, echotimer: %d, echolastupdate: %d\n",
+		module_printk(KERN_INFO, "echostate: %02x, echotimer: %d, echolastupdate: %d\n",
 			(int) mychan->echostate, mychan->echotimer, mychan->echolastupdate);
-		printk(KERN_INFO "itimer: %d, otimer: %d, ringdebtimer: %d\n\n",
+		module_printk(KERN_INFO, "itimer: %d, otimer: %d, ringdebtimer: %d\n\n",
 			mychan->itimer, mychan->otimer, mychan->ringdebtimer);
 #if 0
 		if (mychan->ec_state) {
 			int x;
 			/* Dump the echo canceller parameters */
 			for (x=0;x<mychan->ec_state->taps;x++) {
-				printk(KERN_INFO "tap %d: %d\n", x, mychan->ec_state->fir_taps[x]);
+				module_printk(KERN_INFO, "tap %d: %d\n", x, mychan->ec_state->fir_taps[x]);
 			}
 		}
 #endif
@@ -3523,15 +3529,15 @@
 		return;
 
 #ifdef CONFIG_DAHDI_DEBUG
-	printk("Recalculating slaves on %s\n", chan->name);
+	module_printk(KERN_NOTICE, "Recalculating slaves on %s\n", chan->name);
 #endif
 
 	/* Link all slaves appropriately */
 	for (x=chan->chanpos;x<chan->span->channels;x++)
 		if (chan->span->chans[x].master == chan) {
 #ifdef CONFIG_DAHDI_DEBUG
-			printk("Channel %s, slave to %s, last is %s, its next will be %d\n", 
-			       chan->span->chans[x].name, chan->name, last->name, x);
+			module_printk(KERN_NOTICE, "Channel %s, slave to %s, last is %s, its next will be %d\n", 
+				      chan->span->chans[x].name, chan->name, last->name, x);
 #endif
 			last->nextslave = x;
 			last = &chan->span->chans[x];
@@ -3539,7 +3545,7 @@
 	/* Terminate list */
 	last->nextslave = 0;
 #ifdef CONFIG_DAHDI_DEBUG
-	printk("Done Recalculating slaves on %s (last is %s)\n", chan->name, last->name);
+	module_printk(KERN_NOTICE, "Done Recalculating slaves on %s (last is %s)\n", chan->name, last->name);
 #endif
 }
 
@@ -3664,7 +3670,7 @@
 		if (chans[ch.chan]->flags & DAHDI_FLAG_NETDEV) {
 			if (ztchan_to_dev(chans[ch.chan])->flags & IFF_UP) {
 				spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
-				printk(KERN_WARNING "Can't switch HDLC net mode on channel %s, since current interface is up\n", chans[ch.chan]->name);
+				module_printk(KERN_WARNING, "Can't switch HDLC net mode on channel %s, since current interface is up\n", chans[ch.chan]->name);
 				return -EBUSY;
 			}
 			spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
@@ -3678,7 +3684,7 @@
 #else
 		if (ch.sigtype == DAHDI_SIG_HDLCNET) {
 			spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
-			printk(KERN_WARNING "DAHDI networking not supported by this build.\n");
+			module_printk(KERN_WARNING, "DAHDI networking not supported by this build.\n");
 			return -ENOSYS;
 		}
 #endif			
@@ -3787,13 +3793,13 @@
 					res = dahdi_register_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev, ch.netdev_name);
 					spin_lock_irqsave(&chans[ch.chan]->lock, flags);
 				} else {
-					printk("Unable to allocate hdlc: *shrug*\n");
+					module_printk(KERN_NOTICE, "Unable to allocate hdlc: *shrug*\n");
 					res = -1;
 				}
 				if (!res)
 					chans[ch.chan]->flags |= DAHDI_FLAG_NETDEV;
 			} else {
-				printk("Unable to allocate netdev: out of memory\n");
+				module_printk(KERN_NOTICE, "Unable to allocate netdev: out of memory\n");
 				res = -1;
 			}
 		}
@@ -3801,7 +3807,7 @@
 		if ((chans[ch.chan]->sig == DAHDI_SIG_HDLCNET) && 
 		    (chans[ch.chan] == newmaster) &&
 		    !(chans[ch.chan]->flags & DAHDI_FLAG_NETDEV))
-			printk("Unable to register HDLC device for channel %s\n", chans[ch.chan]->name);
+			module_printk(KERN_NOTICE, "Unable to register HDLC device for channel %s\n", chans[ch.chan]->name);
 		if (!res) {
 			/* Setup default law */
 			chans[ch.chan]->deflaw = ch.deflaw;
@@ -3818,7 +3824,7 @@
 			chans[ch.chan]->rxhooksig = DAHDI_RXSIG_INITIAL;
 		}
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("Configured channel %s, flags %04x, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig);
+		module_printk(KERN_NOTICE, "Configured channel %s, flags %04x, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig);
 #endif			
 		spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
 
@@ -3989,7 +3995,7 @@
 			spin_lock_irqsave(&spans[maint.spanno]->lock, flags);
 			break;
 		default:
-			printk("DAHDI: Unknown maintenance event: %d\n", maint.command);
+			module_printk(KERN_NOTICE, "Unknown maintenance event: %d\n", maint.command);
 		}
 		dahdi_alarm_notify(spans[maint.spanno]);  /* process alarm-related events */
 		spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags);
@@ -4044,7 +4050,7 @@
 	if (!chan->curzone) {
 		spin_unlock_irqrestore(&chan->lock, flags);
 		/* The tone zones are loaded by ztcfg from /etc/dahdi.conf */
-		printk(KERN_WARNING "DAHDI: Cannot dial until a tone zone is loaded.\n");
+		module_printk(KERN_WARNING, "Cannot dial until a tone zone is loaded.\n");
 		return -ENODATA;
 	}
 	switch (tdo->op) {
@@ -4479,24 +4485,23 @@
 				if (!chans[k]) continue;
 				  /* skip if not in this conf */
 				if (chans[k]->confna != i) continue;
-				if (!c) printk("Conf #%d:\n",i);
+				if (!c) module_printk(KERN_NOTICE, "Conf #%d:\n",i);
 				c = 1;
-				printk("chan %d, mode %x\n",
-					k,chans[k]->confmode);
+				module_printk(KERN_NOTICE, "chan %d, mode %x\n", k,chans[k]->confmode);
 			   }
 			rv = 0;
 			for(k = 1; k <= DAHDI_MAX_CONF; k++)
 			   {
 				if (conf_links[k].dst == i)
 				   {
-					if (!c) printk("Conf #%d:\n",i);
+					if (!c) module_printk(KERN_NOTICE, "Conf #%d:\n",i);
 					c = 1;
-					if (!rv) printk("Snooping on:\n");
+					if (!rv) module_printk(KERN_NOTICE, "Snooping on:\n");
 					rv = 1;
-					printk("conf %d\n",conf_links[k].src);
+					module_printk(KERN_NOTICE, "conf %d\n",conf_links[k].src);
 				   }
 			   }
-			if (c) printk("\n");
+			if (c) module_printk(KERN_NOTICE, "\n");
 		   }
 		break;
 	case DAHDI_CHANNO:  /* get channel number of stream */
@@ -4869,7 +4874,7 @@
 			}
 		}
 #else
-		printk("DAHDI: DAHDI PPP support not compiled in\n");
+		module_printk(KERN_NOTICE, "PPP support not compiled in\n");
 		return -ENOSYS;
 #endif
 		break;
@@ -4990,7 +4995,7 @@
 				spin_lock_irqsave(&chan->lock, flags);
 				if (!chan->curzone) {
 					spin_unlock_irqrestore(&chan->lock, flags);
-					printk(KERN_WARNING "DAHDI: Cannot start tone until a tone zone is loaded.\n");
+					module_printk(KERN_WARNING, "Cannot start tone until a tone zone is loaded.\n");
 					return -ENODATA;
 				}
 				if (chan->txstate != DAHDI_TXSTATE_ONHOOK) {
@@ -5082,7 +5087,7 @@
 	int res;
 
 	if (chan) {
-		printk("Huh?  Prechan already has private data??\n");
+		module_printk(KERN_NOTICE, "Huh?  Prechan already has private data??\n");
 	}
 	switch(cmd) {
 	case DAHDI_SPECIFY:
@@ -5135,7 +5140,7 @@
 	if (unit == 255) {
 		chan = file->private_data;
 		if (!chan) {
-			printk("No pseudo channel structure to read?\n");
+			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			return -EINVAL;
 		}
 		return dahdi_chanandpseudo_ioctl(inode, file, cmd, data, chan->channo);
@@ -5153,12 +5158,12 @@
 	if (!span)
 		return -EINVAL;
 	if (span->flags & DAHDI_FLAG_REGISTERED) {
-		printk(KERN_ERR "Span %s already appears to be registered\n", span->name);
+		module_printk(KERN_ERR, "Span %s already appears to be registered\n", span->name);
 		return -EBUSY;
 	}
 	for (x=1;x<maxspans;x++)
 		if (spans[x] == span) {
-			printk(KERN_ERR "Span %s already in list\n", span->name);
+			module_printk(KERN_ERR, "Span %s already in list\n", span->name);
 			return -EBUSY;
 		}
 	for (x=1;x<DAHDI_MAX_SPANS;x++)
@@ -5169,19 +5174,19 @@
 		if (maxspans < x + 1)
 			maxspans = x + 1;
 	} else {
-		printk(KERN_ERR "Too many DAHDI spans registered\n");
+		module_printk(KERN_ERR, "Too many DAHDI spans registered\n");
 		return -EBUSY;
 	}
 	span->flags |= DAHDI_FLAG_REGISTERED;
 	span->spanno = x;
 	spin_lock_init(&span->lock);
 	if (!span->deflaw) {
-		printk("DAHDI: Span %s didn't specify default law.  Assuming mulaw, please fix driver!\n", span->name);
+		module_printk(KERN_NOTICE, "Span %s didn't specify default law.  Assuming mulaw, please fix driver!\n", span->name);
 		span->deflaw = DAHDI_LAW_MULAW;
 	}
 
 	if (span->echocan && span->echocan_with_params) {
-		printk("DAHDI: Span %s implements both echocan and echocan_with_params functions, preserving only echocan_with_params, please fix driver!\n", span->name);
+		module_printk(KERN_NOTICE, "Span %s implements both echocan and echocan_with_params functions, preserving only echocan_with_params, please fix driver!\n", span->name);
 		span->echocan = NULL;
 	}
 
@@ -5204,11 +5209,11 @@
 	}
 
 	if (debug)
-		printk("Registered Span %d ('%s') with %d channels\n", span->spanno, span->name, span->channels);
+		module_printk(KERN_NOTICE, "Registered Span %d ('%s') with %d channels\n", span->spanno, span->name, span->channels);
 	if (!master || prefmaster) {
 		master = span;
 		if (debug)
-			printk("Span ('%s') is new master\n", span->name);
+			module_printk(KERN_NOTICE, "Span ('%s') is new master\n", span->name);
 	}
 	return 0;
 }
@@ -5224,7 +5229,7 @@
 #endif /* CONFIG_PROC_FS */
 
 	if (!(span->flags & DAHDI_FLAG_REGISTERED)) {
-		printk(KERN_ERR "Span %s does not appear to be registered\n", span->name);
+		module_printk(KERN_ERR, "Span %s does not appear to be registered\n", span->name);
 		return -1;
 	}
 	/* Shutdown the span if it's running */
@@ -5233,11 +5238,11 @@
 			span->shutdown(span);
 			
 	if (spans[span->spanno] != span) {
-		printk(KERN_ERR "Span %s has spanno %d which is something else\n", span->name, span->spanno);
+		module_printk(KERN_ERR, "Span %s has spanno %d which is something else\n", span->name, span->spanno);
 		return -1;
 	}
 	if (debug)
-		printk("Unregistering Span '%s' with %d channels\n", span->name, span->channels);
+		module_printk(KERN_NOTICE, "Unregistering Span '%s' with %d channels\n", span->name, span->channels);
 #ifdef CONFIG_PROC_FS
 	sprintf(tempfile, "dahdi/%d", span->spanno);
         remove_proc_entry(tempfile, NULL);
@@ -5267,8 +5272,8 @@
 	maxspans = new_maxspans;
 	if (master != new_master)
 		if (debug)
-			printk("%s: Span ('%s') is new master\n", __FUNCTION__, 
-				(new_master)? new_master->name: "no master");
+			module_printk(KERN_NOTICE, "%s: Span ('%s') is new master\n", __FUNCTION__, 
+				      (new_master)? new_master->name: "no master");
 	master = new_master;
 
 	return 0;
@@ -5446,7 +5451,7 @@
 		for (x=0;x<DAHDI_CHUNKSIZE;x++) {
 			/* Check for echo cancel disabling tone */
 			if (echo_can_disable_detector_update(&ms->txecdis, getlin[x])) {
-				printk("DAHDI Disabled echo canceller because of tone (tx) on channel %d\n", ss->channo);
+				module_printk(KERN_NOTICE, "Disabled echo canceller because of tone (tx) on channel %d\n", ss->channo);
 				ms->echocancel = 0;
 				ms->echostate = ECHO_STATE_IDLE;
 				ms->echolastupdate = 0;
@@ -6133,7 +6138,7 @@
 			}
 			chan->kewlonhook = 0;
 #ifdef CONFIG_DAHDI_DEBUG
-			printk("Off hook on channel %d, itimer = %d, gotgs = %d\n", chan->channo, chan->itimer, chan->gotgs);
+			module_printk(KERN_NOTICE, "Off hook on channel %d, itimer = %d, gotgs = %d\n", chan->channo, chan->itimer, chan->gotgs);
 #endif
 			if (chan->itimer) /* if timer still running */
 			{
@@ -6281,7 +6286,7 @@
 				if (ss->echostate == ECHO_STATE_TRAINING) {
 					if (ss->ec_current->echo_can_traintap(ss->ec_state, ss->echolastupdate++, rxlin)) {
 #if 0
-						printk("Finished training (%d taps trained)!\n", ss->echolastupdate);
+						module_printk(KERN_NOTICE, "Finished training (%d taps trained)!\n", ss->echolastupdate);
 #endif						
 						ss->echostate = ECHO_STATE_ACTIVE;
 					}
@@ -6394,7 +6399,7 @@
 	if (ms->ec_state) {
 		for (x=0;x<DAHDI_CHUNKSIZE;x++) {
 			if (echo_can_disable_detector_update(&ms->rxecdis, putlin[x])) {
-				printk("DAHDI Disabled echo canceller because of tone (rx) on channel %d\n", ss->channo);
+				module_printk(KERN_NOTICE, "Disabled echo canceller because of tone (rx) on channel %d\n", ss->channo);
 				ms->echocancel = 0;
 				ms->echostate = ECHO_STATE_IDLE;
 				ms->echolastupdate = 0;
@@ -6688,7 +6693,7 @@
 						/* Pay attention to the possibility of an overrun */
 						if (ms->readidx[ms->inreadbuf] >= ms->blocksize) {
 							if (!ss->span->alarms) 
-								printk(KERN_WARNING "HDLC Receiver overrun on channel %s (master=%s)\n", ss->name, ss->master->name);
+								module_printk(KERN_WARNING, "HDLC Receiver overrun on channel %s (master=%s)\n", ss->name, ss->master->name);
 							abort=DAHDI_EVENT_OVERRUN;
 							/* Force the HDLC state back to frame-search mode */
 							ms->rxhdlc.state = 0;
@@ -6717,7 +6722,7 @@
 				ms->infcs = PPP_INITFCS;
 				ms->readn[ms->inreadbuf] = ms->readidx[ms->inreadbuf];
 #ifdef CONFIG_DAHDI_DEBUG
-				printk("EOF, len is %d\n", ms->readn[ms->inreadbuf]);
+				module_printk(KERN_NOTICE, "EOF, len is %d\n", ms->readn[ms->inreadbuf]);
 #endif
 #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP)
 				if (ms->flags & (DAHDI_FLAG_NETDEV | DAHDI_FLAG_PPP)) {
@@ -6762,7 +6767,7 @@
 #ifdef CONFIG_DAHDI_PPP
 							if (!ms->do_ppp_error)
 #endif
-								printk("Memory squeeze, dropped one\n");
+								module_printk(KERN_NOTICE, "Memory squeeze, dropped one\n");
 #endif
 						}
 					}
@@ -6795,7 +6800,7 @@
 							   to store into at the moment.  We'll drop it
 							   until there's a buffer available */
 #ifdef CONFIG_DAHDI_DEBUG
-							printk("Out of storage space\n");
+							module_printk(KERN_NOTICE, "Out of storage space\n");
 #endif
 							ms->inreadbuf = -1;
 							/* Enable the receiver in case they've got POLICY_WHEN_FULL */
@@ -6818,7 +6823,7 @@
 							/* Notify a blocked reader that there is data available
 							to be read, unless we're waiting for it to be full */
 #ifdef CONFIG_DAHDI_DEBUG
-							printk("Notifying reader data in block %d\n", oldbuf);
+							module_printk(KERN_NOTICE, "Notifying reader data in block %d\n", oldbuf);
 #endif
 							wake_up_interruptible(&ms->readbufq);
 							wake_up_interruptible(&ms->sel);
@@ -6856,7 +6861,7 @@
 						__qevent(ss->master, abort);
 					}
 #if 0
-				printk("torintr_receive: Aborted %d bytes of frame on %d\n", amt, ss->master);
+				module_printk(KERN_NOTICE, "torintr_receive: Aborted %d bytes of frame on %d\n", amt, ss->master);
 #endif
 
 			}
@@ -6892,7 +6897,7 @@
 			if (!tmp || (tmp[0] != 0xff) || (tmp[1] != 0x03)) {
 				/* Invalid SKB -- drop */
 				if (tmp)
-					printk("Received invalid SKB (%02x, %02x)\n", tmp[0], tmp[1]);
+					module_printk(KERN_NOTICE, "Received invalid SKB (%02x, %02x)\n", tmp[0], tmp[1]);
 				dev_kfree_skb_irq(skb);
 			} else {
 				skb_queue_tail(&ms->ppp_rq, skb);
@@ -6933,7 +6938,7 @@
 	spin_lock_irqsave(&ss->lock, flags);
 	if (ss->inreadbuf < 0) {
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("No place to receive HDLC frame\n");
+		module_printk(KERN_NOTICE, "No place to receive HDLC frame\n");
 #endif
 		spin_unlock_irqrestore(&ss->lock, flags);
 		return;
@@ -6951,7 +6956,7 @@
 	/* Something isn't fit into buffer */
 	if (bytes) {
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("HDLC frame isn't fit into buffer space\n");
+		module_printk(KERN_NOTICE, "HDLC frame isn't fit into buffer space\n");
 #endif
 		__dahdi_hdlc_abort(ss, DAHDI_EVENT_OVERRUN);
 	}
@@ -6968,7 +6973,7 @@
 
 	if ((oldreadbuf = ss->inreadbuf) < 0) {
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("No buffers to finish\n");
+		module_printk(KERN_NOTICE, "No buffers to finish\n");
 #endif
 		spin_unlock_irqrestore(&ss->lock, flags);
 		return;
@@ -6976,7 +6981,7 @@
 
 	if (!ss->readidx[ss->inreadbuf]) {
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("Empty HDLC frame received\n");
+		module_printk(KERN_NOTICE, "Empty HDLC frame received\n");
 #endif
 		spin_unlock_irqrestore(&ss->lock, flags);
 		return;
@@ -6987,7 +6992,7 @@
 	if (ss->inreadbuf == ss->outreadbuf) {
 		ss->inreadbuf = -1;
 #ifdef CONFIG_DAHDI_DEBUG
-		printk("Notifying reader data in block %d\n", oldreadbuf);
+		module_printk(KERN_NOTICE, "Notifying reader data in block %d\n", oldreadbuf);
 #endif
 		ss->rxdisable = 0;
 	}
@@ -7163,7 +7168,7 @@
 	if (unit == 255) {
 		chan = file->private_data;
 		if (!chan) {
-			printk("No pseudo channel structure to read?\n");
+			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			return -EINVAL;
 		}
 		return dahdi_chan_poll(file, wait_table, chan->channo);
@@ -7427,7 +7432,7 @@
 					{
 						if (span->chans[x].pulsecount > 12) {
 						
-							printk("Got pulse digit %d on %s???\n",
+							module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
 						    span->chans[x].pulsecount,
 							span->chans[x].name);
 						} else if (span->chans[x].pulsecount > 11) {
@@ -7571,17 +7576,17 @@
 					(spans[x]->watchstate == DAHDI_WATCHSTATE_UNKNOWN)) {
 					spans[x]->watchstate = DAHDI_WATCHSTATE_RECOVERING;
 					if (spans[x]->watchdog) {
-						printk("Kicking span %s\n", spans[x]->name);
+						module_printk(KERN_NOTICE, "Kicking span %s\n", spans[x]->name);
 						spans[x]->watchdog(spans[x], DAHDI_WATCHDOG_NOINTS);
 					} else {
-						printk("Span %s is dead with no revival\n", spans[x]->name);
+						module_printk(KERN_NOTICE, "Span %s is dead with no revival\n", spans[x]->name);
 						spans[x]->watchstate = DAHDI_WATCHSTATE_FAILED;
 					}
 				}
 			} else {
 				if ((spans[x]->watchstate != DAHDI_WATCHSTATE_OK) &&
 					(spans[x]->watchstate != DAHDI_WATCHSTATE_UNKNOWN))
-						printk("Span %s is alive!\n", spans[x]->name);
+						module_printk(KERN_NOTICE, "Span %s is alive!\n", spans[x]->name);
 				spans[x]->watchstate = DAHDI_WATCHSTATE_OK;
 			}
 			spans[x]->watchcounter = DAHDI_WATCHDOG_INIT;
@@ -7589,7 +7594,7 @@
 	}
 	local_irq_restore(flags);
 	if (!wdcheck) {
-		printk("DAHDI watchdog on duty!\n");
+		module_printk(KERN_NOTICE, "watchdog on duty!\n");
 		wdcheck=1;
 	}
 	mod_timer(&watchdogtimer, jiffies + 2);
@@ -7645,16 +7650,15 @@
 	CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 0), NULL, "dahdictl");
 
 	if ((res = register_chrdev(DAHDI_MAJOR, "dahdi", &dahdi_fops))) {
-		printk(KERN_ERR "Unable to register DAHDI character device handler on %d\n", DAHDI_MAJOR);
+		module_printk(KERN_ERR, "Unable to register DAHDI character device handler on %d\n", DAHDI_MAJOR);
 		return res;
 	}
 
-	printk(KERN_INFO "DAHDI Telephony Interface Registered on major %d\n", DAHDI_MAJOR);
-	printk(KERN_INFO "DAHDI Version: %s\n", DAHDI_VERSION);
+	module_printk(KERN_INFO, "Telephony Interface Registered on major %d\n", DAHDI_MAJOR);
+	module_printk(KERN_INFO, "Version: %s\n", DAHDI_VERSION);
 	dahdi_conv_init();
 	fasthdlc_precalc();
 	rotate_sums();
-	rwlock_init(&chan_lock);
 #ifdef CONFIG_DAHDI_WATCHDOG
 	watchdog_init();
 #endif	
@@ -7664,11 +7668,13 @@
 static void __exit dahdi_cleanup(void) {
 	int x;
 
+	unregister_chrdev(DAHDI_MAJOR, "dahdi");
+
 #ifdef CONFIG_PROC_FS
 	remove_proc_entry("dahdi", NULL);
 #endif
 
-	printk(KERN_INFO "DAHDI Telephony Interface Unloaded\n");
+	module_printk(KERN_INFO, "Telephony Interface Unloaded\n");
 	for (x = 0; x < DAHDI_TONE_ZONE_MAX; x++) {
 		if (tone_zones[x])
 			kfree(tone_zones[x]);
@@ -7680,8 +7686,6 @@
 	class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, 0)); /* ctl */
 	class_destroy(dahdi_class);
 
-	unregister_chrdev(DAHDI_MAJOR, "dahdi");
-
 #ifdef CONFIG_DAHDI_WATCHDOG
 	watchdog_cleanup();
 #endif

Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_dynamic.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=4434&r1=4433&r2=4434
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_dynamic.c Fri Jun 20 17:34:04 2008
@@ -626,7 +626,7 @@
 		/* Try loading the right module */
 		char fn[80];
 		spin_unlock_irqrestore(&dlock, flags);
-		sprintf(fn, "ztd-%s", zds->driver);
+		sprintf(fn, "dahdi_dynamic_%s", zds->driver);
 		request_module(fn);
 		spin_lock_irqsave(&dlock, flags);
 		ztd = find_driver(zds->driver);




More information about the dahdi-commits mailing list