[svn-commits] tzafrir: branch linux/tzafrir/sysfs r8990 - in /linux/team/tzafrir/sysfs: ./ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 26 04:49:50 CDT 2010


Author: tzafrir
Date: Mon Jul 26 04:49:37 2010
New Revision: 8990

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8990
Log:
Merged revisions 8979-8986 via svnmerge from 
https://origsvn.digium.com/svn/dahdi/linux/trunk

........
  r8979 | sruffell | 2010-07-26 03:30:36 +0300 (ב', 26 יול 2010) | 3 lines
  
  wcte12xp, wctdm24xxp: Add shutdown handlers.
  
  Make the drivers a little more kexec friendly.
........
  r8980 | sruffell | 2010-07-26 03:30:36 +0300 (ב', 26 יול 2010) | 1 line
  
  wcte12xp: Do not call destory_workqueue if the workqueue was not yet created.
........
  r8981 | sruffell | 2010-07-26 03:30:37 +0300 (ב', 26 יול 2010) | 6 lines
  
  wcte12xp, wctdm24xxp: spin_lock_bh -> spin_lock_irqsave
  
  Will add an option to allow calling the deferred processing callback directly
  in the interrupt handler.  It appears there are some systems which still are
  unable to process their tasklets in a timely fashion, especially if they get
  pushed out to the ksoftirqd daemon.
........
  r8982 | sruffell | 2010-07-26 03:30:37 +0300 (ב', 26 יול 2010) | 14 lines
  
  wcte12xp, wctdm24xxp: Return buffer processing to interrupt handler.
  
  In revision 8095, I had moved most of the buffer processing out of the
  interrupt handler and into a tasklet. The intended result was to enable
  multiple cards to interleave with one another.  But once again I was
  bitten by the fact that there are some systems that for one reason or
  another do not process their tasklets in a timely enough manner for the
  real-time nature of TDM processing.  This commit moves this processing
  back into the interrupt handler by default.  It also limits the number
  of frames that the interrupt handler will process at any given time
  which appears to achieve the same intended result.
  
  (closes issue #17289)
  Tested by: alecdavis
........
  r8983 | sruffell | 2010-07-26 03:30:38 +0300 (ב', 26 יול 2010) | 7 lines
  
  wcte12xp, wctdm24xxp: Updating VPMADT032 firmware to version to 1.25
  
  The echo canceler will now monitor if the receive signal goes over a
  certain threshold, and if so, freezes its adaptation to prevent loss of
  convergence.  I.e. Fixes conditions where blowing into your handset
  could result in echo.  Additionally, 1.25 includes improvements for
  handling when line conditions change from echo free to containing echo.
........
  r8984 | sruffell | 2010-07-26 03:30:39 +0300 (ב', 26 יול 2010) | 7 lines
  
  dahdi: Remove the 'pvt' member from dahdi_span.
  
  The vast majority of board drivers already keep the dahdi_span structure
  in a driver specific structure.  The others were easily converted.  This
  way board drivers can use the container_of macro to find what was
  previously pointed to by the "pvt" member of the span.  One less thing
  to think about in the span structure.
........
  r8985 | sruffell | 2010-07-26 03:30:41 +0300 (ב', 26 יול 2010) | 5 lines
  
  dahdi: Move the callbacks in dahdi_span into its own structure.
  
  Part of preparation for adding additional callbacks to allow board
  drivers to advertise and support gathering pre-echocan data from hardware
  echocans.
........
  r8986 | sruffell | 2010-07-26 03:30:43 +0300 (ב', 26 יול 2010) | 3 lines
  
  dahdi: Move the 'owner' field from dahdi_span to dahdi_span_ops.
  
  One more thing that can be moved out of the per-span structure.
........

Modified:
    linux/team/tzafrir/sysfs/   (props changed)
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c
    linux/team/tzafrir/sysfs/drivers/dahdi/firmware/Makefile
    linux/team/tzafrir/sysfs/drivers/dahdi/pciradio.c
    linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/GpakApi.c
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/GpakApi.h
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/GpakCust.c
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/gpakErrs.h
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/gpakenum.h
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/voicebus.c
    linux/team/tzafrir/sysfs/drivers/dahdi/voicebus/voicebus.h
    linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Makefile   (props changed)
    linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wcfxo.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/xhfc.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/xhfc.h
    linux/team/tzafrir/sysfs/drivers/dahdi/wcte11xp.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wcte12xp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/card_bri.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/card_fxo.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/card_fxs.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/card_pri.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/xbus-pcm.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/xpp_dahdi.c
    linux/team/tzafrir/sysfs/drivers/dahdi/xpp/xpp_dahdi.h
    linux/team/tzafrir/sysfs/include/dahdi/kernel.h

Propchange: linux/team/tzafrir/sysfs/
------------------------------------------------------------------------------
    svn:mergeinfo = /linux/trunk:8979-8986

Propchange: linux/team/tzafrir/sysfs/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul 26 04:49:37 2010
@@ -1,1 +1,1 @@
-/linux/trunk:1-8977
+yes

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c Mon Jul 26 04:49:37 2010
@@ -508,6 +508,33 @@
 	memset(conf_sums_next, 0, maxconfs * sizeof(sumtype));
 }
 
+static int dahdi_chan_dacs(struct dahdi_chan *chan1, struct dahdi_chan *chan2)
+{
+	if (chan2) {
+		if (chan1->span && chan2->span &&
+		    (chan1->span->ops->dacs == chan2->span->ops->dacs))
+			return chan1->span->ops->dacs(chan1, chan2);
+		else
+			return -ENOSYS;
+	} else {
+		if (chan1->span && chan1->span->ops->dacs)
+			return chan1->span->ops->dacs(chan1, NULL);
+		else
+			return -ENOSYS;
+	}
+}
+
+static int dahdi_chan_echocan_create(struct dahdi_chan *chan,
+				     struct dahdi_echocanparams *ecp,
+				     struct dahdi_echocanparam *p,
+				     struct dahdi_echocan_state **ec)
+{
+	if (chan->span && chan->span->ops->echocan_create)
+		return chan->span->ops->echocan_create(chan, ecp, p, ec);
+	else
+		return -ENODEV;
+}
+
 /*!
  * \return quiescent (idle) signalling states, for the various signalling types
  */
@@ -532,7 +559,7 @@
 		return -1;
 
 	/* if RBS does not apply, return error */
-	if (!(chan->span->flags & DAHDI_FLAG_RBS) || !chan->span->rbsbits)
+	if (!(chan->span->flags & DAHDI_FLAG_RBS) || !chan->span->ops->rbsbits)
 		return -1;
 
 	if (chan->sig == DAHDI_SIG_CAS)
@@ -1313,8 +1340,8 @@
 	memset(chan->conflast1, 0, sizeof(chan->conflast1));
 	memset(chan->conflast2, 0, sizeof(chan->conflast2));
 
-	if (chan->span && chan->span->dacs && oldconf)
-		chan->span->dacs(chan, NULL);
+	if (chan->span && oldconf)
+		dahdi_chan_dacs(chan, NULL);
 
 	if (ec_state) {
 		ec_state->ops->echocan_free(chan, ec_state);
@@ -1978,8 +2005,8 @@
 				/* release conference resource if any */
 				if (chans[x]->confna) {
 					dahdi_check_conf(chans[x]->confna);
-					if (chans[x]->span && chans[x]->span->dacs)
-						chans[x]->span->dacs(chans[x], NULL);
+					if (chans[x]->span)
+						dahdi_chan_dacs(chans[x], NULL);
 				}
 				chans[x]->confna = 0;
 				chans[x]->_confn = 0;
@@ -2252,8 +2279,8 @@
 
 		spin_unlock_irqrestore(&chan->lock, flags);
 
-		if (chan->flags & DAHDI_FLAG_NOSTDTXRX && chan->span->hdlc_hard_xmit)
-			chan->span->hdlc_hard_xmit(chan);
+		if (chan->flags & DAHDI_FLAG_NOSTDTXRX && chan->span->ops->hdlc_hard_xmit)
+			chan->span->ops->hdlc_hard_xmit(chan);
 	}
 	return amnt;
 }
@@ -2374,7 +2401,7 @@
 		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) {
+	if (!chan->span->ops->rbsbits && !chan->span->ops->hooksig) {
 		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;
@@ -2398,10 +2425,10 @@
 		chan->otimer = timeout * DAHDI_CHUNKSIZE;			/* Otimer is timer in samples */
 		return;
 	}
-	if (chan->span->hooksig) {
+	if (chan->span->ops->hooksig) {
 		if (chan->txhooksig != txsig) {
 			chan->txhooksig = txsig;
-			chan->span->hooksig(chan, txsig);
+			chan->span->ops->hooksig(chan, txsig);
 		}
 		chan->otimer = timeout * DAHDI_CHUNKSIZE;			/* Otimer is timer in samples */
 		return;
@@ -2413,7 +2440,7 @@
 #endif
 				chan->txhooksig = txsig;
 				chan->txsig = outs[x].bits[txsig];
-				chan->span->rbsbits(chan, chan->txsig);
+				chan->span->ops->rbsbits(chan, chan->txsig);
 				chan->otimer = timeout * DAHDI_CHUNKSIZE;	/* Otimer is timer in samples */
 				return;
 			}
@@ -2427,9 +2454,9 @@
 	/* if no span, return as error */
 	if (!chan->span)
 		return -1;
-	if (chan->span->rbsbits) {
+	if (chan->span->ops->rbsbits) {
 		chan->txsig = bits;
-		chan->span->rbsbits(chan, bits);
+		chan->span->ops->rbsbits(chan, bits);
 	} else {
 		module_printk(KERN_NOTICE, "Huh?  CAS setbits, but no RBS bits function\n");
 	}
@@ -2468,10 +2495,10 @@
 			dahdi_rbs_sethook(chan, DAHDI_TXSIG_ONHOOK, DAHDI_TXSTATE_ONHOOK, 0);
 	} else {
 		/* Let the driver hang up the line if it wants to  */
-		if (chan->span->sethook) {
+		if (chan->span->ops->sethook) {
 			if (chan->txhooksig != DAHDI_ONHOOK) {
 				chan->txhooksig = DAHDI_ONHOOK;
-				res = chan->span->sethook(chan, DAHDI_ONHOOK);
+				res = chan->span->ops->sethook(chan, DAHDI_ONHOOK);
 			} else
 				res = 0;
 		}
@@ -2582,8 +2609,7 @@
 	if ((chan->sig & __DAHDI_SIG_DACS) != __DAHDI_SIG_DACS) {
 		chan->confna = 0;
 		chan->confmode = 0;
-		if (chan->span && chan->span->dacs)
-			chan->span->dacs(chan, NULL);
+		dahdi_chan_dacs(chan, NULL);
 	}
 	chan->_confn = 0;
 	memset(chan->conflast, 0, sizeof(chan->conflast));
@@ -2709,10 +2735,10 @@
 			if (chan->flags & DAHDI_FLAG_PSEUDO)
 				chan->flags |= DAHDI_FLAG_AUDIO;
 			if (chan->span) {
-				if (!try_module_get(chan->span->owner))
+				if (!try_module_get(chan->span->ops->owner))
 					res = -ENXIO;
-				else if (chan->span->open)
-					res = chan->span->open(chan);
+				else if (chan->span->ops->open)
+					res = chan->span->ops->open(chan);
 			}
 			if (!res) {
 				chan->file = file;
@@ -2744,11 +2770,9 @@
 		spin_unlock_irqrestore(&chan->lock, flags);
 		close_channel(chan);
 		if (chan->span) {
-			struct module *owner = chan->span->owner;
-
-			if (chan->span->close)
-				res = chan->span->close(chan);
-			module_put(owner);
+			if (chan->span->ops->close)
+				res = chan->span->ops->close(chan);
+			module_put(chan->span->ops->owner);
 		}
 		/* The channel might be destroyed by low-level driver span->close() */
 		if (chans[unit])
@@ -3727,7 +3751,7 @@
 			stack.param.rxisoffhook = 1;
 		else
 			stack.param.rxisoffhook = 0;
-		if (chan->span && chan->span->rbsbits && !(chan->sig & DAHDI_SIG_CLEAR)) {
+		if (chan->span && chan->span->ops->rbsbits && !(chan->sig & DAHDI_SIG_CLEAR)) {
 			stack.param.rxbits = chan->rxsig;
 			stack.param.txbits = chan->txsig;
 			stack.param.idlebits = chan->idlebits;
@@ -3736,7 +3760,7 @@
 			stack.param.txbits = -1;
 			stack.param.idlebits = 0;
 		}
-		if (chan->span && (chan->span->rbsbits || chan->span->hooksig) &&
+		if (chan->span && (chan->span->ops->rbsbits || chan->span->ops->hooksig) &&
 			!(chan->sig & DAHDI_SIG_CLEAR)) {
 			stack.param.rxhooksig = chan->rxhooksig;
 			stack.param.txhooksig = chan->txhooksig;
@@ -4088,13 +4112,13 @@
 		if ((lc.lineconfig & 0x1ff0 & spans[lc.span]->linecompat) !=
 		    (lc.lineconfig & 0x1ff0))
 			return -EINVAL;
-		if (spans[lc.span]->spanconfig) {
+		if (spans[lc.span]->ops->spanconfig) {
 			spans[lc.span]->lineconfig = lc.lineconfig;
 			spans[lc.span]->lbo = lc.lbo;
 			spans[lc.span]->txlevel = lc.lbo;
 			spans[lc.span]->rxlevel = 0;
 
-			ret = spans[lc.span]->spanconfig(spans[lc.span], &lc);
+			return spans[lc.span]->ops->spanconfig(spans[lc.span], &lc);
 		}
 		return ret;
 	}
@@ -4103,8 +4127,8 @@
 		if (spans[j]->flags & DAHDI_FLAG_RUNNING)
 			return 0;
 
-		if (spans[j]->startup)
-			res = spans[j]->startup(spans[j]);
+		if (spans[j]->ops->startup)
+			res = spans[j]->ops->startup(spans[j]);
 
 		if (!res) {
 			/* Mark as running and hangup any channels */
@@ -4128,8 +4152,8 @@
 		return 0;
 	case DAHDI_SHUTDOWN:
 		CHECK_VALID_SPAN(j);
-		if (spans[j]->shutdown)
-			res =  spans[j]->shutdown(spans[j]);
+		if (spans[j]->ops->shutdown)
+			res =  spans[j]->ops->shutdown(spans[j]);
 		spans[j]->flags &= ~DAHDI_FLAG_RUNNING;
 		return 0;
 	case DAHDI_ATTACH_ECHOCAN:
@@ -4259,14 +4283,9 @@
 				/* Setup conference properly */
 				chans[ch.chan]->confmode = DAHDI_CONF_DIGITALMON;
 				chans[ch.chan]->confna = ch.idlebits;
-				if (chans[ch.chan]->span &&
-				    chans[ch.chan]->span->dacs &&
-				    chans[ch.idlebits] &&
-				    chans[ch.chan]->span &&
-				    (chans[ch.chan]->span->dacs == chans[ch.idlebits]->span->dacs))
-					chans[ch.chan]->span->dacs(chans[ch.chan], chans[ch.idlebits]);
-			} else if (chans[ch.chan]->span && chans[ch.chan]->span->dacs) {
-				chans[ch.chan]->span->dacs(chans[ch.chan], NULL);
+				dahdi_chan_dacs(chans[ch.chan], chans[ch.idlebits]);
+			} else {
+				dahdi_chan_dacs(chans[ch.chan], NULL);
 			}
 			chans[ch.chan]->master = newmaster;
 			/* Note new slave if we are not our own master */
@@ -4287,8 +4306,8 @@
 				chans[ch.chan]->flags &= ~DAHDI_FLAG_MTP2;
 		}
 
-		if (!res && chans[ch.chan]->span->chanconfig) {
-			res = chans[ch.chan]->span->chanconfig(chans[ch.chan],
+		if (!res && chans[ch.chan]->span->ops->chanconfig) {
+			res = chans[ch.chan]->span->ops->chanconfig(chans[ch.chan],
 							       ch.sigtype);
 		}
 
@@ -4492,7 +4511,7 @@
 		/* must be valid span number */
 		if ((maint.spanno < 1) || (maint.spanno > DAHDI_MAX_SPANS) || (!spans[maint.spanno]))
 			return -EINVAL;
-		if (!spans[maint.spanno]->maint)
+		if (!spans[maint.spanno]->ops->maint)
 			return -ENOSYS;
 		spin_lock_irqsave(&spans[maint.spanno]->lock, flags);
 		  /* save current maint state */
@@ -4507,7 +4526,7 @@
 			/* if same, ignore it */
 			if (i == maint.command)
 				break;
-			rv = spans[maint.spanno]->maint(spans[maint.spanno], maint.command);
+			rv = spans[maint.spanno]->ops->maint(spans[maint.spanno], maint.command);
 			spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags);
 			if (rv)
 				return rv;
@@ -4516,7 +4535,7 @@
 		case DAHDI_MAINT_LOOPUP:
 		case DAHDI_MAINT_LOOPDOWN:
 			spans[maint.spanno]->mainttimer = DAHDI_LOOPCODE_TIME * DAHDI_CHUNKSIZE;
-			rv = spans[maint.spanno]->maint(spans[maint.spanno], maint.command);
+			rv = spans[maint.spanno]->ops->maint(spans[maint.spanno], maint.command);
 			spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags);
 			if (rv)
 				return rv;
@@ -4539,8 +4558,8 @@
 			if(!i)
 				spans[maint.spanno]->maintstat = 0;
 
-			rv = spans[maint.spanno]->maint(spans[maint.spanno],
-							maint.command);
+			rv = spans[maint.spanno]->ops->maint(spans[maint.spanno],
+							     maint.command);
 			spin_unlock_irqrestore(&spans[maint.spanno]->lock,
 					       flags);
 			if (rv)
@@ -4928,17 +4947,15 @@
 		chans[i]->_confn = 0;		     /* Clear confn */
 		dahdi_check_conf(j);
 		dahdi_check_conf(stack.conf.confno);
-		if (chans[i]->span && chans[i]->span->dacs) {
+		if (chans[i]->span && chans[i]->span->ops->dacs) {
 			if (((stack.conf.confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_DIGITALMON) &&
-			    chans[stack.conf.confno]->span &&
-			    chans[stack.conf.confno]->span->dacs == chans[i]->span->dacs &&
 			    chans[i]->txgain == defgain &&
 			    chans[i]->rxgain == defgain &&
 			    chans[stack.conf.confno]->txgain == defgain &&
 			    chans[stack.conf.confno]->rxgain == defgain) {
-				chans[i]->span->dacs(chans[i], chans[stack.conf.confno]);
+				dahdi_chan_dacs(chans[i], chans[stack.conf.confno]);
 			} else {
-				chans[i]->span->dacs(chans[i], NULL);
+				dahdi_chan_dacs(chans[i], NULL);
 			}
 		}
 		/* if we are going onto a conf */
@@ -5137,8 +5154,8 @@
 		rv = dahdi_common_ioctl(file, cmd, data, unit);
 		/* if no span, just return with value */
 		if (!chan->span) return rv;
-		if ((rv == -ENOTTY) && chan->span->ioctl)
-			rv = chan->span->ioctl(chan, cmd, data);
+		if ((rv == -ENOTTY) && chan->span->ops->ioctl)
+			rv = chan->span->ops->ioctl(chan, cmd, data);
 		return rv;
 
 	}
@@ -5238,13 +5255,11 @@
 		ecp->tap_length = deftaps;
 	}
 
-	ret = -ENODEV;
 	ec_current = NULL;
 
 	/* attempt to use the span's echo canceler; fall back to built-in
 	   if it fails (but not if an error occurs) */
-	if (chan->span && chan->span->echocan_create)
-		ret = chan->span->echocan_create(chan, ecp, params, &ec);
+	ret = dahdi_chan_echocan_create(chan, ecp, params, &ec);
 
 	if ((ret == -ENODEV) && chan->ec_factory) {
 		/* try to get another reference to the module providing
@@ -5399,8 +5414,7 @@
 			  /* initialize conference variables */
 			chan->_confn = 0;
 			chan->confna = 0;
-			if (chan->span && chan->span->dacs)
-				chan->span->dacs(chan, NULL);
+			dahdi_chan_dacs(chan, NULL);
 			chan->confmode = 0;
 			chan->confmute = 0;
 			memset(chan->conflast, 0, sizeof(chan->conflast));
@@ -5432,8 +5446,8 @@
 			if (oldconf) dahdi_check_conf(oldconf);
 		}
 #ifdef	DAHDI_AUDIO_NOTIFY
-		if (chan->span->audio_notify)
-			chan->span->audio_notify(chan, j);
+		if (chan->span->ops->audio_notify)
+			chan->span->ops->audio_notify(chan, j);
 #endif
 		break;
 	case DAHDI_HDLCPPP:
@@ -5704,10 +5718,10 @@
 			default:
 				return -EINVAL;
 			}
-		} else if (chan->span->sethook) {
+		} else if (chan->span->ops->sethook) {
 			if (chan->txhooksig != j) {
 				chan->txhooksig = j;
-				chan->span->sethook(chan, j);
+				chan->span->ops->sethook(chan, j);
 			}
 		} else
 			return -ENOSYS;
@@ -5882,7 +5896,12 @@
 	if (!span)
 		return -EINVAL;
 
-	WARN_ON(!span->owner);
+	if (!span->ops)
+		return -EINVAL;
+
+	if (!span->ops->owner)
+		return -EINVAL;
+
 
 	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
 		module_printk(KERN_ERR, "Span %s already appears to be registered\n", span->name);
@@ -5998,8 +6017,8 @@
 	}
 	/* Shutdown the span if it's running */
 	if (span->flags & DAHDI_FLAG_RUNNING)
-		if (span->shutdown)
-			span->shutdown(span);
+		if (span->ops->shutdown)
+			span->ops->shutdown(span);
 
 	if (spans[span->spanno] != span) {
 		module_printk(KERN_ERR, "Span %s has spanno %d which is something else\n", span->name, span->spanno);
@@ -8205,7 +8224,7 @@
 				    	/* Just set bits for our destination */
 					if (span->chans[x]->txsig != chans[span->chans[x]->confna]->rxsig) {
 						span->chans[x]->txsig = chans[span->chans[x]->confna]->rxsig;
-						span->rbsbits(span->chans[x], chans[span->chans[x]->confna]->rxsig);
+						span->ops->rbsbits(span->chans[x], chans[span->chans[x]->confna]->rxsig);
 					}
 				}
 			}
@@ -8217,8 +8236,8 @@
 		span->mainttimer -= DAHDI_CHUNKSIZE;
 		if (span->mainttimer <= 0) {
 			span->mainttimer = 0;
-			if (span->maint)
-				span->maint(span, DAHDI_MAINT_LOOPSTOP);
+			if (span->ops->maint)
+				span->ops->maint(span, DAHDI_MAINT_LOOPSTOP);
 			span->maintstat = 0;
 			wake_up_interruptible(&span->maintq);
 		}
@@ -8318,8 +8337,8 @@
 #ifdef	DAHDI_SYNC_TICK
 	for (x = 0; x < maxspans; x++) {
 		struct dahdi_span *const s = spans[x];
-		if (s && s->sync_tick)
-			s->sync_tick(s, s == master);
+		if (s && s->ops->sync_tick)
+			s->ops->sync_tick(s, s == master);
 	}
 #endif
 	read_unlock(&chan_lock);

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c Mon Jul 26 04:49:37 2010
@@ -199,6 +199,10 @@
 }
 #endif
 
+static const struct dahdi_span_ops dummy_ops = {
+	.owner = THIS_MODULE,
+};
+
 static int dahdi_dummy_initialize(struct dahdi_dummy *ztd)
 {
 	/* DAHDI stuff */
@@ -208,13 +212,12 @@
 	sprintf(ztd->chan->name, "DAHDI_DUMMY/%d/%d", 1, 0);
 	dahdi_copy_string(ztd->span.devicetype, "DAHDI Dummy Timing", sizeof(ztd->span.devicetype));
 	ztd->chan->chanpos = 1;
-	ztd->span.owner = THIS_MODULE;
 	ztd->span.chans = &ztd->chan;
 	ztd->span.channels = 0;		/* no channels on our span */
 	ztd->span.deflaw = DAHDI_LAW_MULAW;
 	init_waitqueue_head(&ztd->span.maintq);
-	ztd->span.pvt = ztd;
 	ztd->chan->pvt = ztd;
+	ztd->span.ops = &dummy_ops;
 	if (dahdi_register(&ztd->span, 0)) {
 		return -1;
 	}

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c Mon Jul 26 04:49:37 2010
@@ -267,9 +267,14 @@
 #define ztdynamic_run __ztdynamic_run
 #endif
 
+static inline struct dahdi_dynamic *dynamic_from_span(struct dahdi_span *span)
+{
+	return container_of(span, struct dahdi_dynamic, span);
+}
+
 void dahdi_dynamic_receive(struct dahdi_span *span, unsigned char *msg, int msglen)
 {
-	struct dahdi_dynamic *ztd = span->pvt;
+	struct dahdi_dynamic *ztd = dynamic_from_span(span);
 	int newerr=0;
 	int sflags;
 	int xlen;
@@ -497,8 +502,7 @@
 
 static int ztd_open(struct dahdi_chan *chan)
 {
-	struct dahdi_dynamic *z;
-	z = chan->span->pvt;
+	struct dahdi_dynamic *z = dynamic_from_span(chan->span);
 	if (likely(z)) {
 		if (unlikely(z->dead))
 			return -ENODEV;
@@ -514,8 +518,7 @@
 
 static int ztd_close(struct dahdi_chan *chan)
 {
-	struct dahdi_dynamic *z;
-	z = chan->span->pvt;
+	struct dahdi_dynamic *z = dynamic_from_span(chan->span);
 	if (z) {
 		z->usecount--;
 		if (z->dead && !z->usecount)
@@ -523,6 +526,14 @@
 	}
 	return 0;
 }
+
+static const struct dahdi_span_ops dynamic_ops = {
+	.owner = THIS_MODULE,
+	.rbsbits = ztd_rbsbits,
+	.open = ztd_open,
+	.close = ztd_close,
+	.chanconfig = ztd_chanconfig,
+};
 
 static int create_dynamic(struct dahdi_dynamic_span *zds)
 {
@@ -582,16 +593,11 @@
 	z->timing = zds->timing;
 	sprintf(z->span.name, "DYN/%s/%s", zds->driver, zds->addr);
 	sprintf(z->span.desc, "Dynamic '%s' span at '%s'", zds->driver, zds->addr);
-	z->span.owner = THIS_MODULE;
 	z->span.channels = zds->numchans;
-	z->span.pvt = z;
 	z->span.deflaw = DAHDI_LAW_MULAW;
 	z->span.flags |= DAHDI_FLAG_RBS;
 	z->span.chans = z->chans;
-	z->span.rbsbits = ztd_rbsbits;
-	z->span.open = ztd_open;
-	z->span.close = ztd_close;
-	z->span.chanconfig = ztd_chanconfig;
+	z->span.ops = &dynamic_ops;
 	for (x=0; x < z->span.channels; x++) {
 		sprintf(z->chans[x]->name, "DYN/%s/%s/%d", zds->driver, zds->addr, x+1);
 		z->chans[x]->sigcap = DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS |

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/firmware/Makefile
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/firmware/Makefile?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/firmware/Makefile (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/firmware/Makefile Mon Jul 26 04:49:37 2010
@@ -25,7 +25,7 @@
 OCT6114_064_VERSION:=1.05.01
 OCT6114_128_VERSION:=1.05.01
 TC400M_VERSION:=MR6.12
-VPMADT032_VERSION:=1.20.0
+VPMADT032_VERSION:=1.25.0
 HX8_VERSION:=2.06
 
 FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/pciradio.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/pciradio.c?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/pciradio.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/pciradio.c Mon Jul 26 04:49:37 2010
@@ -1423,7 +1423,7 @@
 static int pciradio_watchdog(struct dahdi_span *span, int event)
 {
 	printk(KERN_INFO "PCI RADIO: Restarting DMA\n");
-	pciradio_restart_dma(span->pvt);
+	pciradio_restart_dma(container_of(span, struct pciradio, span));
 	return 0;
 }
 
@@ -1458,12 +1458,20 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops pciradio_span_ops = {
+	.owner = THIS_MODULE,
+	.hooksig = pciradio_hooksig,
+	.open = pciradio_open,
+	.close = pciradio_close,
+	.ioctl = pciradio_ioctl,
+	.watchdog = pciradio_watchdog,
+};
+
 static int pciradio_initialize(struct pciradio *rad)
 {
 	int x;
 
 	/* DAHDI stuff */
-	rad->span.owner = THIS_MODULE;
 	sprintf(rad->span.name, "PCIRADIO/%d", rad->pos);
 	sprintf(rad->span.desc, "Board %d", rad->pos + 1);
 	rad->span.deflaw = DAHDI_LAW_MULAW;
@@ -1478,15 +1486,10 @@
 	}
 	rad->span.chans = &rad->chans;
 	rad->span.channels = rad->nchans;
-	rad->span.hooksig = pciradio_hooksig;
-	rad->span.open = pciradio_open;
-	rad->span.close = pciradio_close;
 	rad->span.flags = DAHDI_FLAG_RBS;
-	rad->span.ioctl = pciradio_ioctl;
-	rad->span.watchdog = pciradio_watchdog;
+	rad->span.ops = &pciradio_span_ops;
 	init_waitqueue_head(&rad->span.maintq);
 
-	rad->span.pvt = rad;
 	if (dahdi_register(&rad->span, 0)) {
 		printk(KERN_NOTICE "Unable to register span with DAHDI\n");
 		return -1;

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c?view=diff&rev=8990&r1=8989&r2=8990
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c Mon Jul 26 04:49:37 2010
@@ -71,6 +71,7 @@
 	   span number and pointer to the tor device */
 	struct tor2 *tor;
 	int span;	/* Index from 0 */
+	struct dahdi_span dahdi_span;
 };
 
 struct tor2 {
@@ -96,7 +97,6 @@
 	unsigned long xilinx8_region;	/* 8 bit Region allocated to Xilinx */
 	unsigned long xilinx8_len;	/* Length of 8 bit Xilinx region */
 	__iomem volatile unsigned char *mem8;	/* Virtual representation of 8 bit Xilinx memory area */
-	struct dahdi_span spans[SPANS_PER_CARD];		/* Spans */
 	struct tor2_span tspans[SPANS_PER_CARD];	/* Span data */
 	struct dahdi_chan **chans[SPANS_PER_CARD]; /* Pointers to card channels */
 	struct tor2_chan tchans[32 * SPANS_PER_CARD];	/* Channel user data */
@@ -195,7 +195,7 @@
 static int tor2_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
 {
 	int i;
-	struct tor2_span *p = span->pvt;
+	struct tor2_span *p = container_of(span, struct tor2_span, dahdi_span);
 
 	if (debug)
 		printk(KERN_INFO "Tor2: Configuring span %d\n", span->spanno);
@@ -259,52 +259,57 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops tor2_span_ops = {
+	.owner = THIS_MODULE,
+	.spanconfig = tor2_spanconfig,
+	.chanconfig = tor2_chanconfig,
+	.startup = tor2_startup,
+	.shutdown = tor2_shutdown,
+	.rbsbits = tor2_rbsbits,
+	.maint = tor2_maint,
+	.open = tor2_open,
+	.close  = tor2_close,
+	.ioctl = tor2_ioctl,
+};
+
 static void init_spans(struct tor2 *tor)
 {
 	int x, y, c;
 	/* TODO: a debug printk macro */
 	for (x = 0; x < SPANS_PER_CARD; x++) {
-		sprintf(tor->spans[x].name, "Tor2/%d/%d", tor->num, x + 1);
-		snprintf(tor->spans[x].desc, sizeof(tor->spans[x].desc) - 1,
+		struct dahdi_span *const s = &tor->tspans[x].dahdi_span;
+		sprintf(s->name, "Tor2/%d/%d", tor->num, x + 1);
+		snprintf(s->desc, sizeof(s->desc) - 1,
 			 "Tormenta 2 (PCI) Quad %s Card %d Span %d",
 			 (tor->cardtype == TYPE_T1)  ?  "T1"  :  "E1", tor->num, x + 1);
-		tor->spans[x].manufacturer = "Digium";
-		dahdi_copy_string(tor->spans[x].devicetype, tor->type, sizeof(tor->spans[x].devicetype));
-		snprintf(tor->spans[x].location, sizeof(tor->spans[x].location) - 1,
+		s->manufacturer = "Digium";
+		dahdi_copy_string(s->devicetype, tor->type, sizeof(s->devicetype));
+		snprintf(s->location, sizeof(s->location) - 1,
 			 "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
-		tor->spans[x].owner = THIS_MODULE;
-		tor->spans[x].spanconfig = tor2_spanconfig;
-		tor->spans[x].chanconfig = tor2_chanconfig;
-		tor->spans[x].startup = tor2_startup;
-		tor->spans[x].shutdown = tor2_shutdown;
-		tor->spans[x].rbsbits = tor2_rbsbits;
-		tor->spans[x].maint = tor2_maint;
-		tor->spans[x].open = tor2_open;
-		tor->spans[x].close  = tor2_close;
 		if (tor->cardtype == TYPE_T1) {
-			tor->spans[x].channels = 24;
-			tor->spans[x].deflaw = DAHDI_LAW_MULAW;
-			tor->spans[x].linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF;
-			tor->spans[x].spantype = "T1";
+			s->channels = 24;
+			s->deflaw = DAHDI_LAW_MULAW;
+			s->linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF;
+			s->spantype = "T1";
 		} else {
-			tor->spans[x].channels = 31;
-			tor->spans[x].deflaw = DAHDI_LAW_ALAW;
-			tor->spans[x].linecompat = DAHDI_CONFIG_HDB3 | DAHDI_CONFIG_CCS | DAHDI_CONFIG_CRC4;
-			tor->spans[x].spantype = "E1";
-		}
-		tor->spans[x].chans = tor->chans[x];
-		tor->spans[x].flags = DAHDI_FLAG_RBS;
-		tor->spans[x].ioctl = tor2_ioctl;
-		tor->spans[x].pvt = &tor->tspans[x];
+			s->channels = 31;
+			s->deflaw = DAHDI_LAW_ALAW;
+			s->linecompat = DAHDI_CONFIG_HDB3 | DAHDI_CONFIG_CCS | DAHDI_CONFIG_CRC4;
+			s->spantype = "E1";
+		}
+		s->chans = tor->chans[x];
+		s->flags = DAHDI_FLAG_RBS;
+		s->ops = &tor2_span_ops;
+
 		tor->tspans[x].tor = tor;
 		tor->tspans[x].span = x;
-		init_waitqueue_head(&tor->spans[x].maintq);
-		for (y=0;y<tor->spans[x].channels;y++) {
+		init_waitqueue_head(&s->maintq);
+		for (y = 0; y < s->channels; y++) {
 			struct dahdi_chan *mychans = tor->chans[x][y];
 			sprintf(mychans->name, "Tor2/%d/%d/%d", tor->num, x + 1, y + 1);
 			mychans->sigcap = DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXSKS |
  									 DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS | DAHDI_SIG_FXOKS | DAHDI_SIG_CAS | DAHDI_SIG_SF | DAHDI_SIG_EM_E1;
-			c = (x * tor->spans[x].channels) + y;
+			c = (x * s->channels) + y;
 			mychans->pvt = &tor->tchans[c];
 			mychans->chanpos = y + 1;
 			tor->tchans[c].span = x;
@@ -315,36 +320,34 @@
 
 static int __devinit tor2_launch(struct tor2 *tor)
 {
-	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[0].flags))
+	struct dahdi_span *s;
+	int i;
+
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->tspans[0].dahdi_span.flags))
 		return 0;
+
 	printk(KERN_INFO "Tor2: Launching card: %d\n", tor->order);
-	if (dahdi_register(&tor->spans[0], 0)) {
-		printk(KERN_ERR "Unable to register span %s\n", tor->spans[0].name);
-		return -1;
-	}
-	if (dahdi_register(&tor->spans[1], 0)) {
-		printk(KERN_ERR "Unable to register span %s\n", tor->spans[1].name);
-		dahdi_unregister(&tor->spans[0]);
-		return -1;
-	}
-	if (dahdi_register(&tor->spans[2], 0)) {
-		printk(KERN_ERR "Unable to register span %s\n", tor->spans[2].name);
-		dahdi_unregister(&tor->spans[0]);
-		dahdi_unregister(&tor->spans[1]);
-		return -1;
-	}
-	if (dahdi_register(&tor->spans[3], 0)) {
-		printk(KERN_ERR "Unable to register span %s\n", tor->spans[3].name);
-		dahdi_unregister(&tor->spans[0]);
-		dahdi_unregister(&tor->spans[1]);
-		dahdi_unregister(&tor->spans[2]);
-		return -1;
+	for (i = 0; i < SPANS_PER_CARD; ++i) {
+		s = &tor->tspans[i].dahdi_span;
+		if (dahdi_register(s, 0)) {
+			printk(KERN_ERR "Unable to register span %s\n", s->name);
+			goto error_exit;
+		}
 	}
 	tor->plx[INTCSR] = cpu_to_le16(PLX_INTENA); /* enable PLX interrupt */
+
 #ifdef ENABLE_TASKLETS
 	tasklet_init(&tor->tor2_tlet, tor2_tasklet, (unsigned long)tor);
 #endif
 	return 0;
+
+error_exit:
+	for (i = 0; i < SPANS_PER_CARD; ++i) {
+		s = &tor->tspans[i].dahdi_span;
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &s->flags))
+			dahdi_unregister(s);
+	}
+	return -1;
 }
 
 static void free_tor(struct tor2 *tor)
@@ -630,8 +633,9 @@
 	tor->plx[INTCSR] = cpu_to_le16(0);
 	free_irq(tor->irq, tor);
 	for (i = 0; i < SPANS_PER_CARD; ++i) {
-		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[i].flags))
-			dahdi_unregister(&tor->spans[i]);
+		struct dahdi_span *s = &tor->tspans[i].dahdi_span;
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &s->flags))
+			dahdi_unregister(s);
 	}
 	release_mem_region(tor->plx_region, tor->plx_len);
 	release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
@@ -669,9 +673,10 @@
 	int i,j,s;
 	unsigned short val=0;
 	for (s = 0; s < SPANS_PER_CARD; s++) {
+		struct dahdi_span *span = &tor->tspans[s].dahdi_span;
 		for (i = 0; i < 24; i++) {
 			j = (i/8);
-			if (tor->spans[s].chans[i]->flags & DAHDI_FLAG_CLEAR) 
+			if (span->chans[i]->flags & DAHDI_FLAG_CLEAR)
 				val |= 1 << (i % 8);
 
 			if ((i % 8)==7) {
@@ -763,7 +768,8 @@
 	int tspan;
 	int wasrunning;
 	unsigned long flags;
-	struct tor2_span *p = span->pvt;
+	struct tor2_span *const p = container_of(span, struct tor2_span, dahdi_span);
+	struct tor2 *const tor = p->tor;
 
 	tspan = p->span + 1;
 	if (tspan < 0) {
@@ -771,27 +777,27 @@
 		return -1;
 	}
 
-	spin_lock_irqsave(&p->tor->lock, flags);
+	spin_lock_irqsave(&tor->lock, flags);
 	wasrunning = span->flags & DAHDI_FLAG_RUNNING;
 
 	span->flags &= ~DAHDI_FLAG_RUNNING;
 	/* Zero out all registers */
-	if (p->tor->cardtype == TYPE_E1) {
+	if (tor->cardtype == TYPE_E1) {
 		for (i = 0; i < 192; i++)
-			t1out(p->tor,tspan, i, 0);
+			t1out(tor, tspan, i, 0);
 	} else {
 		for (i = 0; i < 160; i++)
-			t1out(p->tor,tspan, i, 0);
+			t1out(tor, tspan, i, 0);
 	}
 	if (wasrunning)
-		p->tor->spansstarted--;
-	spin_unlock_irqrestore(&p->tor->lock, flags);	
-	if (!(p->tor->spans[0].flags & DAHDI_FLAG_RUNNING) &&
-	    !(p->tor->spans[1].flags & DAHDI_FLAG_RUNNING) &&
-	    !(p->tor->spans[2].flags & DAHDI_FLAG_RUNNING) &&
-	    !(p->tor->spans[3].flags & DAHDI_FLAG_RUNNING))
+		tor->spansstarted--;
+	spin_unlock_irqrestore(&tor->lock, flags);
+	if (!(tor->tspans[0].dahdi_span.flags & DAHDI_FLAG_RUNNING) &&
+	    !(tor->tspans[1].dahdi_span.flags & DAHDI_FLAG_RUNNING) &&
+	    !(tor->tspans[2].dahdi_span.flags & DAHDI_FLAG_RUNNING) &&
+	    !(tor->tspans[3].dahdi_span.flags & DAHDI_FLAG_RUNNING))
 		/* No longer in use, disable interrupts */
-		p->tor->mem8[CTLREG] = 0;
+		tor->mem8[CTLREG] = 0;
 	if (debug)
 		printk(KERN_DEBUG"Span %d (%s) shutdown\n", span->spanno, span->name);
 	return 0;
@@ -808,7 +814,7 @@
 	char *framing;
 	char *crcing;
 	int alreadyrunning;
-	struct tor2_span *p = span->pvt;
+	struct tor2_span *p = container_of(span, struct tor2_span, dahdi_span);
 
 	tspan = p->span + 1;
 	if (tspan < 0) {
@@ -1011,7 +1017,7 @@
 
 static int tor2_maint(struct dahdi_span *span, int cmd)
 {
-	struct tor2_span *p = span->pvt;
+	struct tor2_span *p = container_of(span, struct tor2_span, dahdi_span);
 
 	int tspan = p->span + 1;
 
@@ -1074,26 +1080,28 @@
 {
 	int x,y;
 	for (x = 0; x < SPANS_PER_CARD; x++) {
-		if (tor->spans[x].flags & DAHDI_FLAG_RUNNING) {
+		struct dahdi_span *const s = &tor->tspans[x].dahdi_span;
+		if (s->flags & DAHDI_FLAG_RUNNING) {
 			/* since the Tormenta 2 PCI is double-buffered, you
 			   need to delay the transmit data 2 entire chunks so
 			   that the transmit will be in sync with the receive */
-			for (y=0;y<tor->spans[x].channels;y++) {
-				dahdi_ec_chunk(tor->spans[x].chans[y], 
-				    tor->spans[x].chans[y]->readchunk, 
-					tor->ec_chunk2[x][y]);
+			for (y = 0; y < s->channels; y++) {
+				dahdi_ec_chunk(s->chans[y],
+					       s->chans[y]->readchunk,
+					       tor->ec_chunk2[x][y]);
 				memcpy(tor->ec_chunk2[x][y],tor->ec_chunk1[x][y],
 					DAHDI_CHUNKSIZE);
 				memcpy(tor->ec_chunk1[x][y],
-					tor->spans[x].chans[y]->writechunk,
+					s->chans[y]->writechunk,
 						DAHDI_CHUNKSIZE);
 			}
-			dahdi_receive(&tor->spans[x]);
+			dahdi_receive(s);
 		}
 	}
 	for (x = 0; x < SPANS_PER_CARD; x++) {
-		if (tor->spans[x].flags & DAHDI_FLAG_RUNNING)
-			dahdi_transmit(&tor->spans[x]);
+		struct dahdi_span *const s = &tor->tspans[x].dahdi_span;
+		if (s->flags & DAHDI_FLAG_RUNNING)
+			dahdi_transmit(s);
 	}
 }
 
@@ -1142,10 +1150,10 @@
 					if (cards[x]->syncpos[i]) {
 						nonzero = 1;
 						if ((cards[x]->syncpos[i] == p) &&
-						    !(cards[x]->spans[i].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_LOOPBACK)) &&
-							(cards[x]->spans[i].flags & DAHDI_FLAG_RUNNING)) {
+						    !(cards[x]->tspans[i].dahdi_span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_LOOPBACK)) &&
+							(cards[x]->tspans[i].dahdi_span.flags & DAHDI_FLAG_RUNNING)) {
 								/* This makes a good sync source */
-								newsyncsrc = cards[x]->spans[i].spanno;
+								newsyncsrc = cards[x]->tspans[i].dahdi_span.spanno;
 								newsyncnum = x;
 								newsyncspan = i + 1;
 								/* Jump out */
@@ -1173,7 +1181,7 @@
 		tor->syncsrc = syncsrc;
 		/* Update sync sources */
 		for (i = 0; i < SPANS_PER_CARD; i++) {
-			tor->spans[i].syncsrc = tor->syncsrc;
+			tor->tspans[i].dahdi_span.syncsrc = tor->syncsrc;
 		}
 		if (syncnum == tor->num) {
 #if 1
@@ -1223,16 +1231,16 @@
 #endif
 
 	/* do the transmit output */
-	for (n = 0; n < tor->spans[0].channels; n++) {
+	for (n = 0; n < tor->tspans[0].dahdi_span.channels; n++) {
 		for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
 			/* span 1 */
-			txword = tor->spans[0].chans[n]->writechunk[i] << 24;
+			txword = tor->tspans[0].dahdi_span.chans[n]->writechunk[i] << 24;
 			/* span 2 */
-			txword |= tor->spans[1].chans[n]->writechunk[i] << 16;
+			txword |= tor->tspans[1].dahdi_span.chans[n]->writechunk[i] << 16;
 			/* span 3 */
-			txword |= tor->spans[2].chans[n]->writechunk[i] << 8;
+			txword |= tor->tspans[2].dahdi_span.chans[n]->writechunk[i] << 8;
 			/* span 4 */
-			txword |= tor->spans[3].chans[n]->writechunk[i];
+			txword |= tor->tspans[3].dahdi_span.chans[n]->writechunk[i];
 			/* write to part */
 #ifdef FIXTHISFOR64
 			tor->mem32[tor->datxlt[n] + (32 * i)] = txword;
@@ -1243,7 +1251,7 @@
 	}
 
 	/* Do the receive input */
-	for (n = 0; n < tor->spans[0].channels; n++) {
+	for (n = 0; n < tor->tspans[0].dahdi_span.channels; n++) {
 		for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
 			/* read from */
 #ifdef FIXTHISFOR64
@@ -1252,13 +1260,13 @@
 			rxword = le32_to_cpu(tor->mem32[tor->datxlt[n] + (32 * i)]);
 #endif
 			/* span 1 */
-			tor->spans[0].chans[n]->readchunk[i] = rxword >> 24;
+			tor->tspans[0].dahdi_span.chans[n]->readchunk[i] = rxword >> 24;
 			/* span 2 */
-			tor->spans[1].chans[n]->readchunk[i] = (rxword & 0xff0000) >> 16;
+			tor->tspans[1].dahdi_span.chans[n]->readchunk[i] = (rxword & 0xff0000) >> 16;
 			/* span 3 */
-			tor->spans[2].chans[n]->readchunk[i] = (rxword & 0xff00) >> 8;
+			tor->tspans[2].dahdi_span.chans[n]->readchunk[i] = (rxword & 0xff00) >> 8;
 			/* span 4 */
-			tor->spans[3].chans[n]->readchunk[i] = rxword & 0xff;
+			tor->tspans[3].dahdi_span.chans[n]->readchunk[i] = rxword & 0xff;
 		}
 	}
 
@@ -1269,16 +1277,16 @@

[... 2711 lines stripped ...]



More information about the svn-commits mailing list