[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-vpmdebug r8918 - in /linux/team/s...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 13 17:22:30 CDT 2010


Author: sruffell
Date: Tue Jul 13 17:22:25 2010
New Revision: 8918

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8918
Log:
Bring in all changes from 2.1.0 -> 2.1.0.4

Added:
    linux/team/sruffell/dahdi-linux-vpmdebug/.version   (with props)
Modified:
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dummy.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dynamic.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_echocan_oslec.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/tor2.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcb4xxp/base.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct1xxp.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct4xxp/base.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wctc4xxp/base.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte11xp.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-core.h
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-sysfs.c
    linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xdefs.h
    linux/team/sruffell/dahdi-linux-vpmdebug/include/dahdi/kernel.h

Added: linux/team/sruffell/dahdi-linux-vpmdebug/.version
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/.version?view=auto&rev=8918
==============================================================================
Binary file - no diff available.

Propchange: linux/team/sruffell/dahdi-linux-vpmdebug/.version
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: linux/team/sruffell/dahdi-linux-vpmdebug/.version
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: linux/team/sruffell/dahdi-linux-vpmdebug/.version
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi-base.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi-base.c Tue Jul 13 17:22:25 2010
@@ -175,7 +175,7 @@
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
 #define CLASS_DEV_DESTROY(class, devt) \
 	class_device_destroy(class, devt)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
 #define CLASS_DEV_DESTROY(class, devt) \
 	class_simple_device_remove(devt)
 #else
@@ -1146,7 +1146,7 @@
 		*c = tolower(*d);
 	}
 
-	request_module(modname_buf);
+	request_module("%s", modname_buf);
 
 	tried_once = 1;
 
@@ -1161,6 +1161,14 @@
 #endif
 }
 
+/** 
+ * close_channel - close the channel, resetting any channel variables
+ * @chan: the dahdi_chan to close
+ *
+ * This function might be called before the channel is placed on the global
+ * array of channels, (chans), and therefore, neither this function nor it's
+ * children should depend on the dahdi_chan.channo member which is not set yet.
+ */
 static void close_channel(struct dahdi_chan *chan)
 {
 	unsigned long flags;
@@ -1478,43 +1486,43 @@
 static int dahdi_chan_reg(struct dahdi_chan *chan)
 {
 	int x;
-	int res = 0;
 	unsigned long flags;
 
 	might_sleep();
+
+	spin_lock_init(&chan->lock);
+	if (!chan->master)
+		chan->master = chan;
+	if (!chan->readchunk)
+		chan->readchunk = chan->sreadchunk;
+	if (!chan->writechunk)
+		chan->writechunk = chan->swritechunk;
+	dahdi_set_law(chan, 0);
+	close_channel(chan);
 
 	write_lock_irqsave(&chan_lock, flags);
 	for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
 		if (chans[x])
 			continue;
 
-		spin_lock_init(&chan->lock);
 		chans[x] = chan;
 		if (maxchans < x + 1)
 			maxchans = x + 1;
 		chan->channo = x;
-		if (!chan->master)
-			chan->master = chan;
-		if (!chan->readchunk)
-			chan->readchunk = chan->sreadchunk;
-		if (!chan->writechunk)
-			chan->writechunk = chan->swritechunk;
 		write_unlock_irqrestore(&chan_lock, flags);
-		dahdi_set_law(chan, 0);
-		close_channel(chan);
 		/* set this AFTER running close_channel() so that
 		   HDLC channels wont cause hangage */
-		chan->flags |= DAHDI_FLAG_REGISTERED;
-		res = 0;
+		set_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags);
 		break;
 	}
 
 	if (DAHDI_MAX_CHANNELS == x) {
 		write_unlock_irqrestore(&chan_lock, flags);
 		module_printk(KERN_ERR, "No more channels available\n");
-	}
-
-	return res;
+		return -ENOMEM;
+	}
+
+	return 0;
 }
 
 char *dahdi_lboname(int x)
@@ -1877,9 +1885,9 @@
 	}
 #endif
 	write_lock_irqsave(&chan_lock, flags);
-	if (chan->flags & DAHDI_FLAG_REGISTERED) {
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags)) {
 		chans[chan->channo] = NULL;
-		chan->flags &= ~DAHDI_FLAG_REGISTERED;
+		clear_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags);
 	}
 #ifdef CONFIG_DAHDI_PPP
 	if (chan->ppp) {
@@ -2355,7 +2363,7 @@
 	}
 
 	/* if not registered yet, just return here */
-	if (!(chan->flags & DAHDI_FLAG_REGISTERED))
+	if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags))
 		return res;
 
 	/* Mark all buffers as empty */
@@ -5353,7 +5361,7 @@
 	if (!span)
 		return -EINVAL;
 
-	if (span->flags & DAHDI_FLAG_REGISTERED) {
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
 		module_printk(KERN_ERR, "Span %s already appears to be registered\n", span->name);
 		return -EBUSY;
 	}
@@ -5379,7 +5387,7 @@
 		return -EBUSY;
 	}
 
-	span->flags |= DAHDI_FLAG_REGISTERED;
+	set_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
 	span->spanno = x;
 
 	spin_lock_init(&span->lock);
@@ -5447,7 +5455,7 @@
 	char tempfile[17];
 #endif /* CONFIG_PROC_FS */
 
-	if (!(span->flags & DAHDI_FLAG_REGISTERED)) {
+	if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
 		module_printk(KERN_ERR, "Span %s does not appear to be registered\n", span->name);
 		return -1;
 	}
@@ -5474,7 +5482,7 @@
 
 	spans[span->spanno] = NULL;
 	span->spanno = 0;
-	span->flags &= ~DAHDI_FLAG_REGISTERED;
+	clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
 	for (x=0;x<span->channels;x++)
 		dahdi_chan_unreg(span->chans[x]);
 	new_maxspans = 0;
@@ -7606,7 +7614,7 @@
 int dahdi_receive(struct dahdi_span *span)
 {
 	int x,y,z;
-	unsigned long flags, flagso;
+	unsigned long flags;
 
 #if 1
 #ifdef CONFIG_DAHDI_WATCHDOG
@@ -7688,7 +7696,8 @@
 	if (span == master) {
 		/* Hold the big zap lock for the duration of major
 		   activities which touch all sorts of channels */
-		spin_lock_irqsave(&bigzaplock, flagso);
+		spin_lock_irqsave(&bigzaplock, flags);
+		read_lock(&chan_lock);
 		/* Process any timers */
 		process_timers();
 		/* If we have dynamic stuff, call the ioctl with 0,0 parameters to
@@ -7698,12 +7707,12 @@
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && chans[x]->confmode && !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				u_char *data;
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				data = __buf_peek(&chans[x]->confin);
 				__dahdi_receive_chunk(chans[x], data);
 				if (data)
 					__buf_pull(&chans[x]->confin, NULL,chans[x], "confreceive");
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		/* This is the master channel, so make things switch over */
@@ -7711,9 +7720,9 @@
 		/* do all the pseudo and/or conferenced channel receives (getbuf's) */
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				__dahdi_transmit_chunk(chans[x], NULL);
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		if (maxlinks) {
@@ -7736,21 +7745,21 @@
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				unsigned char tmp[DAHDI_CHUNKSIZE];
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				__dahdi_getempty(chans[x], tmp);
 				__dahdi_receive_chunk(chans[x], tmp);
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && chans[x]->confmode && !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				u_char *data;
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				data = __buf_pushpeek(&chans[x]->confout);
 				__dahdi_transmit_chunk(chans[x], data);
 				if (data)
 					__buf_push(&chans[x]->confout, NULL, "conftransmit");
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 #ifdef	DAHDI_SYNC_TICK
@@ -7761,7 +7770,8 @@
 				s->sync_tick(s, s == master);
 		}
 #endif
-		spin_unlock_irqrestore(&bigzaplock, flagso);
+		read_unlock(&chan_lock);
+		spin_unlock_irqrestore(&bigzaplock, flags);
 	}
 #endif
 	return 0;

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dummy.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dummy.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dummy.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dummy.c Tue Jul 13 17:22:25 2010
@@ -54,7 +54,7 @@
  * the #define USE_RTC should be commented out.
  */
 #if defined(__i386__) || defined(__x86_64__)
-#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,13)
+#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,15)
 /* The symbol hrtimer_forward is only exported as of 2.6.22: */
 #if defined(CONFIG_HIGH_RES_TIMERS) && LINUX_VERSION_CODE >= VERSION_CODE(2,6,22)
 #define USE_HIGHRESTIMER
@@ -220,8 +220,7 @@
 /* use kernel system tick timer if PC architecture RTC is not available */
 static void dahdi_dummy_timer(unsigned long param)
 {
-	hrtimer_set_expires(timer, jiffies + 1);
-	add_timer(&timer);
+	mod_timer(&timer, jiffies + 1);
 
 	ztd->counter += DAHDI_TIME;
 	while (ztd->counter >= HZ) {

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_dynamic.c Tue Jul 13 17:22:25 2010
@@ -414,7 +414,7 @@
 	unsigned int x;
 
 	/* Unregister span if appropriate */
-	if (z->span.flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &z->span.flags))
 		dahdi_unregister(&z->span);
 
 	/* Destroy the pvt stuff if there */

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_echocan_oslec.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_echocan_oslec.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_echocan_oslec.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/dahdi_echocan_oslec.c Tue Jul 13 17:22:25 2010
@@ -46,7 +46,14 @@
 
 static void echo_can_update(struct echo_can_state *ec, short *iref, short *isig)
 {
-	oslec_update((struct oslec_state *)ec, *iref, *isig);
+	unsigned int SampleNum;
+
+	for (SampleNum = 0; SampleNum < DAHDI_CHUNKSIZE; SampleNum++, iref++)
+	{
+		short iCleanSample;
+		iCleanSample = (short) oslec_update((struct oslec_state *)ec, *iref, *isig);
+		*isig++ = iCleanSample;
+	}
 }
 
 static int echo_can_create(struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p,
@@ -57,8 +64,7 @@
 		return -EINVAL;
 	}
 
-	/* TODO: get adaption mode from EC parameters? */
-	*ec = (struct echo_can_state *)oslec_create(ecp->tap_length, 0);
+	*ec = (struct echo_can_state *)oslec_create(ecp->tap_length, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP  | ECHO_CAN_USE_CLIP | ECHO_CAN_USE_TX_HPF | ECHO_CAN_USE_RX_HPF);
 
 	return *ec ? 0 : -ENOTTY;
 }

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/tor2.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/tor2.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/tor2.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/tor2.c Tue Jul 13 17:22:25 2010
@@ -200,7 +200,7 @@
 	if (debug)
 		printk(KERN_INFO "Tor2: Configuring span %d\n", span->spanno);
 
-	if ((lc->sync < 0) || (lc->sync >= MAX_TOR_CARDS)) {
+	if ((lc->sync < 0) || (lc->sync >= SPANS_PER_CARD)) {
 		printk(KERN_WARNING "%s %d: invalid span timing value %d.\n",
 				THIS_MODULE->name, span->spanno, lc->sync);
 		return -EINVAL;
@@ -314,7 +314,7 @@
 
 static int __devinit tor2_launch(struct tor2 *tor)
 {
-	if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[0].flags))
 		return 0;
 	printk(KERN_INFO "Tor2: Launching card: %d\n", tor->order);
 	if (dahdi_register(&tor->spans[0], 0)) {
@@ -618,6 +618,7 @@
 static void __devexit tor2_remove(struct pci_dev *pdev)
 {
 	struct tor2 *tor;
+	int i;
 
 	tor = pci_get_drvdata(pdev);
 	if (!tor)
@@ -627,14 +628,10 @@
 	tor->mem8[LEDREG] = 0;
 	tor->plx[INTCSR] = cpu_to_le16(0);
 	free_irq(tor->irq, tor);
-	if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[0]);
-	if (tor->spans[1].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[1]);
-	if (tor->spans[2].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[2]);
-	if (tor->spans[3].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[3]);
+	for (i = 0; i < SPANS_PER_CARD; ++i) {
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[i].flags))
+			dahdi_unregister(&tor->spans[i]);
+	}
 	release_mem_region(tor->plx_region, tor->plx_len);
 	release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
 	release_mem_region(tor->xilinx8_region, tor->xilinx8_len);

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcb4xxp/base.c Tue Jul 13 17:22:25 2010
@@ -34,7 +34,6 @@
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <linux/spinlock.h>
-#include <linux/mutex.h>
 #include <linux/device.h>	/* dev_err() */
 #include <linux/interrupt.h>
 #include <asm/system.h>		/* cli(), *_flags */
@@ -136,9 +135,8 @@
 	unsigned char ret = ioread8(b4->addr + reg);
 
 #ifdef DEBUG_LOWLEVEL_REGS
-	if (unlikely(DBG_REGS)) {
-		drv_dbg(b4->dev, "read 0x%02x from 0x%08x\n", ret, b4->addr + reg);
-	}
+	if (unlikely(DBG_REGS))
+		drv_dbg(b4->dev, "read 0x%02x from 0x%p\n", ret, b4->addr + reg);
 #endif
 	if (unlikely(pedanticpci)) {
 		udelay(3);
@@ -152,9 +150,8 @@
 	unsigned short ret = ioread16(b4->addr + reg);
 
 #ifdef DEBUG_LOWLEVEL_REGS
-	if (unlikely(DBG_REGS)) {
-		drv_dbg(b4->dev, "read 0x%04x from 0x%08x\n", ret, b4->addr + reg);
-	}
+	if (unlikely(DBG_REGS))
+		drv_dbg(b4->dev, "read 0x%04x from 0x%p\n", ret, b4->addr + reg);
 #endif
 	if (unlikely(pedanticpci)) {
 		udelay(3);
@@ -168,9 +165,8 @@
 	unsigned int ret = ioread32(b4->addr + reg);
 
 #ifdef DEBUG_LOWLEVEL_REGS
-	if (unlikely(DBG_REGS)) {
-		drv_dbg(b4->dev, "read 0x%04x from 0x%08x\n", ret, b4->addr + reg);
-	}
+	if (unlikely(DBG_REGS))
+		drv_dbg(b4->dev, "read 0x%04x from 0x%p\n", ret, b4->addr + reg);
 #endif
 	if (unlikely(pedanticpci)) {
 		udelay(3);
@@ -182,9 +178,8 @@
 static inline void __pci_out32(struct b4xxp *b4, const unsigned int reg, const unsigned int val)
 {
 #ifdef DEBUG_LOWLEVEL_REGS
-	if (unlikely(DBG_REGS)) {
-		drv_dbg(b4->dev, "writing 0x%02x to 0x%08x\n", val, b4->addr + reg);
-	}
+	if (unlikely(DBG_REGS))
+		drv_dbg(b4->dev, "writing 0x%02x to 0x%p\n", val, b4->addr + reg);
 #endif
 	iowrite32(val, b4->addr + reg);
 
@@ -197,9 +192,8 @@
 static inline void __pci_out8(struct b4xxp *b4, const unsigned int reg, const unsigned char val)
 {
 #ifdef DEBUG_LOWLEVEL_REGS
-	if (unlikely(DBG_REGS)) {
-		drv_dbg(b4->dev, "writing 0x%02x to 0x%08x\n", val, b4->addr + reg);
-	}
+	if (unlikely(DBG_REGS)) 
+		drv_dbg(b4->dev, "writing 0x%02x to 0x%p\n", val, b4->addr + reg);
 #endif
 	iowrite8(val, b4->addr + reg);
 
@@ -682,25 +676,33 @@
 }
 
 /* performs a register write and then waits for the HFC "busy" bit to clear */
-static inline void hfc_setreg_waitbusy(struct b4xxp *b4, const unsigned int reg, const unsigned int val)
-{
-	unsigned long maxwait;
-
-	maxwait = 1048576;
+static void hfc_setreg_waitbusy(struct b4xxp *b4, const unsigned int reg, const unsigned int val)
+{
+	int timeout = 0;
+	unsigned long start;
+	const int TIMEOUT = HZ/4; /* 250ms */
+
+	start = jiffies;
 	while (unlikely((b4xxp_getreg8(b4, R_STATUS) & V_BUSY))) {
-		maxwait--; /* FIXME: do what? it isn't busy for long */
+		if (time_after(jiffies, start + TIMEOUT)) {
+			timeout = 1;
+			break;
+		}
 	};
 
 	mb();
 	b4xxp_setreg8(b4, reg, val);
 	mb();
 
-	maxwait = 1048576;
+	start = jiffies;
 	while (likely((b4xxp_getreg8(b4, R_STATUS) & V_BUSY))) {
-		maxwait--; /* FIXME: do what? it isn't busy for long */
+		if (time_after(jiffies, start + TIMEOUT)) {
+			timeout = 1;
+			break;
+		}
 	};
 
-	if (!maxwait) {
+	if (timeout) {
 		if (printk_ratelimit())
 			dev_warn(b4->dev, "hfc_setreg_waitbusy(write 0x%02x to 0x%02x) timed out waiting for busy flag to clear!\n", val, reg);
 	}
@@ -1577,7 +1579,8 @@
 		spin_unlock_irqrestore(&b4->fifolock, irq_flags);
 
 /* don't send STAT byte to DAHDI */
-		dahdi_hdlc_putbuf(bspan->sigchan, buf, (j == WCB4XXP_HDLC_BUF_LEN) ? j : j - 1);
+		if (bspan->sigchan)
+			dahdi_hdlc_putbuf(bspan->sigchan, buf, (j == WCB4XXP_HDLC_BUF_LEN) ? j : j - 1);
 
 		zleft -= j;
 		if (DBG_HDLC && DBG_SPANFILTER) {
@@ -1592,6 +1595,11 @@
 	hfc_setreg_waitbusy(b4, A_INC_RES_FIFO, V_INC_F);
 	get_F(f1, f2, flen);
 	spin_unlock_irqrestore(&b4->fifolock, irq_flags);
+
+	/* If this channel is not configured with a signalling span we don't
+	 * need to notify the rest of dahdi about this frame. */
+	if (!bspan->sigchan)
+		return flen;
 
 	++bspan->frames_in;
 	if (zlen < 3) {

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct1xxp.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct1xxp.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct1xxp.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct1xxp.c Tue Jul 13 17:22:25 2010
@@ -624,7 +624,7 @@
 		t1xxp_e1_framer_start(wc);
 	else
 		t1xxp_t1_framer_start(wc);
-	printk(KERN_INFO "Calling startup (flags is %d)\n", span->flags);
+	printk(KERN_INFO "Calling startup (flags is %lu)\n", span->flags);
 
 	if (!alreadyrunning) {
 		/* Only if we're not already going */

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct4xxp/base.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wct4xxp/base.c Tue Jul 13 17:22:25 2010
@@ -3441,7 +3441,7 @@
 {
 	int x;
 	unsigned long flags;
-	if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &wc->tspans[0]->span.flags))
 		return 0;
 	printk(KERN_INFO "TE%dXXP: Launching card: %d\n", wc->numspans, wc->order);
 
@@ -3726,6 +3726,8 @@
 static void __devexit t4_remove_one(struct pci_dev *pdev)
 {
 	struct t4 *wc = pci_get_drvdata(pdev);
+	struct dahdi_span *span;
+	int i;
 
 	if (!wc) {
 		return;
@@ -3739,15 +3741,11 @@
 		release_vpm450m(wc->vpm450m);
 	wc->vpm450m = NULL;
 	/* Unregister spans */
-	if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&wc->tspans[0]->span);
-	if (wc->tspans[1]->span.flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&wc->tspans[1]->span);
-	if (wc->numspans == 4) {
-		if (wc->tspans[2]->span.flags & DAHDI_FLAG_REGISTERED)
-			dahdi_unregister(&wc->tspans[2]->span);
-		if (wc->tspans[3]->span.flags & DAHDI_FLAG_REGISTERED)
-			dahdi_unregister(&wc->tspans[3]->span);
+
+	for (i = 0; i < wc->numspans; ++i) {
+		span = &wc->tspans[i]->span;
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags))
+			dahdi_unregister(span);
 	}
 #ifdef ENABLE_WORKQUEUES
 	if (wc->workq) {

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wctc4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wctc4xxp/base.c Tue Jul 13 17:22:25 2010
@@ -171,6 +171,13 @@
 	__le16 channel_type;
 	__le16 timeslot;
 } __attribute__((packed));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+/* also added in RHEL kernels with the OpenInfiniband backport: */
+#if LINUX_VERSION_CODE != KERNEL_VERSION(2,6,9) || !defined(DEFINE_SPINLOCK)
+typedef	unsigned gfp_t;		/* Added in 2.6.14 */
+#endif
+#endif
 
 #define CMD_MSG_TDM_SELECT_BUS_MODE_LEN 30
 #define CMD_MSG_TDM_SELECT_BUS_MODE(s) { \

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte11xp.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte11xp.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte11xp.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte11xp.c Tue Jul 13 17:22:25 2010
@@ -898,7 +898,7 @@
 
 	/* Reset framer with proper parameters and start */
 	t1xxp_framer_start(wc, span);
-	printk(KERN_INFO "Calling startup (flags is %d)\n", span->flags);
+	printk(KERN_INFO "Calling startup (flags is %lu)\n", span->flags);
 
 	if (!alreadyrunning) {
 		/* Only if we're not already going */

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/wcte12xp/base.c Tue Jul 13 17:22:25 2010
@@ -203,9 +203,9 @@
 	}
 }
 
-static inline int t1_setreg_full(struct t1 *wc, int addr, int val, int inisr, int vpm_num)
-{
-	unsigned long flags;
+static inline int t1_setreg_full(struct t1 *wc, int addr, int val, const int inisr, int vpm_num)
+{
+	unsigned long flags = 0;
 	int hit;
 	int ret;
 
@@ -225,8 +225,8 @@
 		}
 		if (inisr)
 			break;
-	
-		spin_unlock_irqrestore(&wc->reglock, flags);
+		else
+			spin_unlock_irqrestore(&wc->reglock, flags);
 		if (hit < 0) {
 			if ((ret = schluffen(&wc->regq)))
 				return ret;
@@ -301,9 +301,9 @@
 	return ret;
 }
 
-static inline int t1_getreg_full(struct t1 *wc, int addr, int inisr, int vpm_num)
-{
-	unsigned long flags;
+static inline int t1_getreg_full(struct t1 *wc, int addr, const int inisr, int vpm_num)
+{
+	unsigned long flags = 0;
 	int hit;
 	int ret = 0;
 
@@ -356,9 +356,9 @@
 	return t1_getreg_full(wc, addr, inisr, NOT_VPM);
 }
 
-static inline int t1_setleds(struct t1 *wc, int leds, int inisr)
-{
-	unsigned long flags;
+static inline int t1_setleds(struct t1 *wc, int leds, const int inisr)
+{
+	unsigned long flags = 0;
 	int hit;
 	int ret = 0;
 
@@ -697,7 +697,7 @@
 
 	/* Reset framer with proper parameters and start */
 	t1xxp_framer_start(wc, span);
-	debug_printk(1, "Calling startup (flags is %d)\n", span->flags);
+	debug_printk(1, "Calling startup (flags is %lu)\n", span->flags);
 
 	return 0;
 }

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-core.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-core.h?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-core.h (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-core.h Tue Jul 13 17:22:25 2010
@@ -319,7 +319,7 @@
 int	xbus_sysfs_create(xbus_t *xbus);
 void	xbus_sysfs_remove(xbus_t *xbus);
 
-#ifdef	OLD_HOTPLUG_SUPPORT
+#ifdef	OLD_HOTPLUG_SUPPORT_269
 /* Copy from new kernels lib/kobject_uevent.c */
 enum kobject_action {
 	KOBJ_ADD,

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-sysfs.c?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-sysfs.c (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xbus-sysfs.c Tue Jul 13 17:22:25 2010
@@ -319,20 +319,22 @@
 	XBUS_DBG(DEVICES, xbus, "SYFS bus_id=%s action=%d\n",
 		xbus->astribank.bus_id, act);
 
-#ifdef	OLD_HOTPLUG_SUPPORT
-	{
-		/* Copy from new kernels lib/kobject_uevent.c */
-		static const char	*str[] = {
-			[KOBJ_ADD]	"add",
-			[KOBJ_REMOVE]	"remove",
-			[KOBJ_CHANGE]	"change",
-			[KOBJ_MOUNT]	"mount",
-			[KOBJ_UMOUNT]	"umount",
-			[KOBJ_OFFLINE]	"offline",
-			[KOBJ_ONLINE]	"online"
-		};
-		kobject_hotplug(str[act], kobj);
-	}
+#if defined(OLD_HOTPLUG_SUPPORT_269)
+ 	{
+ 		/* Copy from new kernels lib/kobject_uevent.c */
+ 		static const char	*str[] = {
+ 			[KOBJ_ADD]	"add",
+ 			[KOBJ_REMOVE]	"remove",
+ 			[KOBJ_CHANGE]	"change",
+ 			[KOBJ_MOUNT]	"mount",
+ 			[KOBJ_UMOUNT]	"umount",
+ 			[KOBJ_OFFLINE]	"offline",
+ 			[KOBJ_ONLINE]	"online"
+ 		};
+ 		kobject_hotplug(str[act], kobj);
+ 	}
+#elif defined(OLD_HOTPLUG_SUPPORT)
+	kobject_hotplug(kobj, act);
 #else
 	kobject_uevent(kobj, act);
 #endif

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xdefs.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xdefs.h?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xdefs.h (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/drivers/dahdi/xpp/xdefs.h Tue Jul 13 17:22:25 2010
@@ -120,6 +120,9 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
 #define	OLD_HOTPLUG_SUPPORT	// for older kernels
 #endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#define	OLD_HOTPLUG_SUPPORT_269// for way older kernels
+#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
 #define	DEVICE_ATTR_READER(name,dev,buf)	\

Modified: linux/team/sruffell/dahdi-linux-vpmdebug/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-vpmdebug/include/dahdi/kernel.h?view=diff&rev=8918&r1=8917&r2=8918
==============================================================================
--- linux/team/sruffell/dahdi-linux-vpmdebug/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-vpmdebug/include/dahdi/kernel.h Tue Jul 13 17:22:25 2010
@@ -76,6 +76,13 @@
 #define DAHDI_IRQ_SHARED SA_SHIRQ
 #define DAHDI_IRQ_DISABLED SA_INTERRUPT
 #define DAHDI_IRQ_SHARED_DISABLED SA_SHIRQ | SA_INTERRUPT
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
+#ifndef dev_notice
+#define dev_notice(dev, format, arg...)         \
+        dev_printk(KERN_NOTICE , dev , format , ## arg)
+#endif
 #endif
 
 /*! Default chunk size for conferences and such -- static right now, might make
@@ -512,7 +519,7 @@
 	char location[40];		/*!< span device's location in system */
 	int deflaw;			/*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */
 	int alarms;			/*!< Pending alarms on span */
-	int flags;
+	unsigned long flags;
 	int irq;			/*!< IRQ for this span's hardware */
 	int lbo;			/*!< Span Line-Buildout */
 	int lineconfig;			/*!< Span line configuration */




More information about the svn-commits mailing list