[zaptel-commits] tzafrir: trunk r1409 - in /trunk/xpp: card_fxs.c xpp_zap.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Sep 5 22:14:22 MST 2006


Author: tzafrir
Date: Wed Sep  6 00:14:22 2006
New Revision: 1409

URL: http://svn.digium.com/view/zaptel?rev=1409&view=rev
Log:
More cleanup:
xpp_zap.c:
* Remove old and long unused character device interface.
* Show some extra fields in XPD summary proc file.
* Move atomic_dec() to correct position
card_fxs.c: Remove unused label.

Modified:
    trunk/xpp/card_fxs.c
    trunk/xpp/xpp_zap.c

Modified: trunk/xpp/card_fxs.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxs.c?rev=1409&r1=1408&r2=1409&view=diff
==============================================================================
--- trunk/xpp/card_fxs.c (original)
+++ trunk/xpp/card_fxs.c Wed Sep  6 00:14:22 2006
@@ -829,7 +829,6 @@
 			}
 		}
 	}
-out:
 	/* Update /proc info only if reply relate to the last slic read request */
 	if(priv->requested_reply.indirect == info->indirect &&
 			priv->requested_reply.reg_num == info->reg_num) {

Modified: trunk/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpp_zap.c?rev=1409&r1=1408&r2=1409&view=diff
==============================================================================
--- trunk/xpp/xpp_zap.c (original)
+++ trunk/xpp/xpp_zap.c Wed Sep  6 00:14:22 2006
@@ -56,7 +56,6 @@
 #define	PROC_XPD_SUMMARY	"summary"
 #endif
 
-#define	XPP_CTL_MAJOR		42
 #define	MAX_QUEUE_LEN		10000
 #define	SAMPLE_TICKS		10000
 #define	DELAY_UNTIL_DIALTONE	3000
@@ -407,9 +406,21 @@
 	for_each_line(xpd, i) {
 		len += sprintf(page + len, "%d ", IS_SET(xpd->cid_on, i));
 	}
+	len += sprintf(page + len, "\n\t%-17s: ", "lasttxhook");
+	for_each_line(xpd, i) {
+		len += sprintf(page + len, "%d ", xpd->lasttxhook[i]);
+	}
+	len += sprintf(page + len, "\n\t%-17s: ", "idletxhookstate");
+	for_each_line(xpd, i) {
+		len += sprintf(page + len, "%d ", xpd->idletxhookstate[i]);
+	}
 	len += sprintf(page + len, "\n\t%-17s: ", "ringing");
 	for_each_line(xpd, i) {
 		len += sprintf(page + len, "%d ", xpd->ringing[i]);
+	}
+	len += sprintf(page + len, "\n\t%-17s: ", "no_pcm");
+	for_each_line(xpd, i) {
+		len += sprintf(page + len, "%d ", IS_SET(xpd->no_pcm, i));
 	}
 #if 1
 	if(SPAN_REGISTERED(xpd)) {
@@ -431,7 +442,7 @@
 			wp = chans[i].writechunk;
 #else
 			rp = (byte *)xpd->readchunk + (ZT_CHUNKSIZE * i);
-			wp = chans[i].writechunk;
+			wp = (byte *)xpd->writechunk + (ZT_CHUNKSIZE * i);
 #endif
 			memcpy(rchunk, rp, ZT_CHUNKSIZE);
 			memcpy(wchunk, wp, ZT_CHUNKSIZE);
@@ -1292,16 +1303,15 @@
 	spin_lock_irqsave(&xpd->lock, flags);
 
 	if(!SPAN_REGISTERED(xpd)) {
-		NOTICE("%s: %s is already unregistered\n", __FUNCTION__, xpd->xpdname);
+		NOTICE("%s/%s is already unregistered\n", xpd->xbus->busname, xpd->xpdname);
 		spin_unlock_irqrestore(&xpd->lock, flags);
 		return -EIDRM;
 	}
-	atomic_dec(&xpd->zt_registered);
 	if(sync_master == xpd)
 		sync_master_is(NULL);			// FIXME: it's better to elect a new prince
 	update_xpd_status(xpd, ZT_ALARM_NOTOPEN);
 	if(atomic_read(&xpd->open_counter)) {
-		NOTICE("%s: %s is busy (open_counter=%d). Skipping.\n", __FUNCTION__, xpd->xpdname, atomic_read(&xpd->open_counter));
+		NOTICE("%s/%s is busy (open_counter=%d). Skipping.\n", xpd->xbus->busname, xpd->xpdname, atomic_read(&xpd->open_counter));
 		spin_unlock_irqrestore(&xpd->lock, flags);
 		return -EBUSY;
 	}
@@ -1309,6 +1319,7 @@
 	spin_unlock_irqrestore(&xpd->lock, flags);
 	if(xpd->card_present)
 		xpd->xops->card_zaptel_preregistration(xpd, 0);
+	atomic_dec(&xpd->zt_registered);
 	zt_unregister(&xpd->span);
 	if(xpd->card_present)
 		xpd->xops->card_zaptel_postregistration(xpd, 0);
@@ -1389,112 +1400,12 @@
 
 #endif
 
-/*------------------------- File Operations ------------------------*/
-
-#define	MINOR_XBUS_NUM(m)	((m) >> 4)
-#define	MINOR_XPD_NUM(m)	((m) & 0xF);
-
-#if 0
-static int xpp_sys_open (struct inode * inode, struct file * file)
-{
-	xbus_t *xbus;
-	unsigned int minor = iminor(inode);
-	unsigned int busnum = MINOR_XBUS_NUM(minor);
-	unsigned long flags;
-
-	spin_lock_irqsave(&xbuses_lock, flags);
-	xbus = xbus_of(busnum);
-	spin_unlock_irqrestore(&xbuses_lock, flags);
-	if(xbus == NULL)
-		return -ENODEV;
-	file->private_data = xbus;
-	DBG("unit %d xbus %s\n", busnum, xbus->busname);
-	return 0;
-}
-
-static int xpp_sys_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
-	switch(cmd) {
-		default:
-			return -ENOTTY;
-	}
-	return 0;
-}
-
-static int xpp_sys_release (struct inode * inode, struct file * file)
-{
-	unsigned int minor = iminor(inode);
-	unsigned int busnum = MINOR_XBUS_NUM(minor);
-	xbus_t *xbus = file->private_data;
-	DBG("unit %d xbus %s\n", busnum, xbus->busname);
-	if(xbus == NULL) {
-		ERR("xpp_sys_release: xbus has dissappeared\n");
-		return -EINVAL;
-	}
-	return 0;
-}
-
-#if 0
-static ssize_t xpp_sys_write (struct file * file, const char __user * buf,
-			 size_t count, loff_t * ppos)
-{
-	unsigned int minor = iminor(file->f_dentry->d_inode);
-	unsigned int busnum = MINOR_XBUS_NUM(minor);
-	int xpdnum = MINOR_XPD_NUM(minor)
-	xbus_t *xbus = file->private_data;
-	xpacket_t *pack_tx;
-
-	DBG("count=%d from %d/%d xbus %s\n", count, busnum, xpdnum, xbus->busname);
-	if(xbus == NULL) {
-		ERR("xpp_sys_write: xbus has dissappeared\n");
-		return -EINVAL;
-	}
-	if(count == 0)
-		return 0;
-	if(count >= sizeof(xpacket_raw_t)) {
-		DBG("count=%d, partial write...\n", count);
-		count = sizeof(xpacket_raw_t);
-	}
-	pack_tx = xbus->ops->packet_new(xbus, GFP_KERNEL);
-	if (!pack_tx) {
-		return -ENOMEM;
-	}
-	if (copy_from_user (pack_tx->content.raw, buf, count)) {
-		return -EFAULT;
-	}
-	xpd_set_addr(&pack_tx->content.addr, xpdnum);
-	pack_tx->datalen = count;
-	// pack_tx->flags |= XPP_PACKET_FIREANDFORGET;
-	DBG("sending op=%d to %d\n", pack_tx->content.opcode, xpdnum);
-	xbus_reset_counters(xbus);
-	pcm_write_enable = 1;
-	packet_send(xbus, pack_tx);
-	return count;
-}
-#endif
-
-static struct file_operations xpp_fops = {
-	.owner		= THIS_MODULE,
-	.llseek		= no_llseek,
-#if 0
-	.write		= xpp_sys_write,
-#endif
-	.ioctl		= xpp_sys_ioctl,
-	.open		= xpp_sys_open,
-	.release	= xpp_sys_release,
-};
-
-#endif
-
 /*------------------------- Initialization -------------------------*/
 
 static void do_cleanup(void)
 {
 	if(timer_pending(&xpp_timer))
 		del_timer_sync(&xpp_timer);
-#if 0
-	unregister_chrdev(XPP_CTL_MAJOR, THIS_MODULE->name);
-#endif
 #ifdef CONFIG_PROC_FS
 	DBG("Removing '%s' from proc\n", PROC_SYNC);
 	remove_proc_entry(PROC_SYNC, xpp_proc_toplevel);
@@ -1511,7 +1422,8 @@
 	int	ret;
 	struct proc_dir_entry *ent;
 
-	INFO("%s revision %s\n", THIS_MODULE->name, ZAPTEL_VERSION);
+	INFO("%s revision %s MAX_XPDS=%d\n", THIS_MODULE->name, ZAPTEL_VERSION,
+			MAX_XPDS);
 #ifdef WITH_RBS
 	INFO("FEATURE: %s (RBS signalling)\n", THIS_MODULE->name);
 #else
@@ -1550,14 +1462,6 @@
 		do_cleanup();
 		return ret;
 	}
-	
-#if 0
-	if (register_chrdev(XPP_CTL_MAJOR, THIS_MODULE->name, &xpp_fops)) {
-		printk (KERN_WARNING "%s: unable to get major %d\n", THIS_MODULE->name, XPP_CTL_MAJOR);
-		do_cleanup();
-		return -EIO;
-	}
-#endif
 
 	/* Only timer init. We add it only *after* zt_register */
 	init_timer(&xpp_timer);



More information about the zaptel-commits mailing list