[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-spancleanup r7035 - in /linux/tea...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 18 10:01:38 CDT 2009


Author: sruffell
Date: Tue Aug 18 10:01:34 2009
New Revision: 7035

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=7035
Log:
dahdi_ops-wip: Move the callbacks into its own structure.

Modified:
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi_dynamic.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/pciradio.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/tor2.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcfxo.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct1xxp.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte11xp.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_bri.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_pri.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.c
    linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.h
    linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c Tue Aug 18 10:01:34 2009
@@ -523,7 +523,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)
@@ -2227,8 +2227,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;
 }
@@ -2349,7 +2349,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;
@@ -2373,10 +2373,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;
@@ -2388,7 +2388,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;
 			}
@@ -2402,9 +2402,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");
 	}
@@ -2443,10 +2443,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;
 		}
@@ -2686,8 +2686,8 @@
 			if (chan->span) {
 				if (!try_module_get(chan->span->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;
@@ -2719,8 +2719,8 @@
 		spin_unlock_irqrestore(&chan->lock, flags);
 		close_channel(chan);
 		if (chan->span) {
-			if (chan->span->close)
-				res = chan->span->close(chan);
+			if (chan->span->ops->close)
+				res = chan->span->ops->close(chan);
 			module_put(chan->span->owner);
 		}
 		/* The channel might be destroyed by low-level driver span->close() */
@@ -3559,7 +3559,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;
@@ -3568,7 +3568,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;
@@ -3898,13 +3898,13 @@
 		VALID_SPAN(lc.span);
 		if ((lc.lineconfig & 0x07f0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0x07f0))
 			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;
 
-			return spans[lc.span]->spanconfig(spans[lc.span], &lc);
+			return spans[lc.span]->ops->spanconfig(spans[lc.span], &lc);
 		}
 		return 0;
 	}
@@ -3913,8 +3913,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 */
@@ -3938,8 +3938,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:
@@ -4027,8 +4027,8 @@
 		if ((sigcap & ch.sigtype) != ch.sigtype)
 			res = -EINVAL;
 
-		if (!res && chans[ch.chan]->span->chanconfig)
-			res = chans[ch.chan]->span->chanconfig(chans[ch.chan], ch.sigtype);
+		if (!res && chans[ch.chan]->span->ops->chanconfig)
+			res = chans[ch.chan]->span->ops->chanconfig(chans[ch.chan], ch.sigtype);
 
 		if (chans[ch.chan]->master != chans[ch.chan]) {
 			struct dahdi_chan *oldmaster = chans[ch.chan]->master;
@@ -4300,7 +4300,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 */
@@ -4314,7 +4314,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;
@@ -4323,7 +4323,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;
@@ -4911,8 +4911,8 @@
 		rv = dahdi_common_ioctl(inode, 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;
 
 	}
@@ -5466,10 +5466,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;
@@ -5668,8 +5668,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);
@@ -7835,7 +7835,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);
 					}
 				}
 			}
@@ -7847,8 +7847,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);
 		}
@@ -7948,8 +7948,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/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi_dynamic.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi_dynamic.c Tue Aug 18 10:01:34 2009
@@ -538,6 +538,13 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops dynamic_ops = {
+	.rbsbits = ztd_rbsbits,
+	.open = ztd_open,
+	.close = ztd_close,
+	.chanconfig = ztd_chanconfig,
+};
+
 static int create_dynamic(struct dahdi_dynamic_span *zds)
 {
 	struct dahdi_dynamic *z;
@@ -609,10 +616,7 @@
 	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/sruffell/dahdi-linux-spancleanup/drivers/dahdi/pciradio.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/pciradio.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/pciradio.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/pciradio.c Tue Aug 18 10:01:34 2009
@@ -1457,6 +1457,14 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops pciradio_span_ops = {
+	.hooksig = pciradio_hooksig,
+	.open = pciradio_open,
+	.close = pciradio_close,
+	.ioctl = pciradio_ioctl,
+	.watchdog = pciradio_watchdog,
+};
+
 static int pciradio_initialize(struct pciradio *rad)
 {
 	int x;
@@ -1477,12 +1485,8 @@
 	}
 	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);
 
 	if (dahdi_register(&rad->span, 0)) {

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/tor2.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/tor2.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/tor2.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/tor2.c Tue Aug 18 10:01:34 2009
@@ -259,6 +259,18 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops tor2_span_ops = {
+	.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;
@@ -274,14 +286,6 @@
 		snprintf(s->location, sizeof(s->location) - 1,
 			 "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
 		s->owner = THIS_MODULE;
-		s->spanconfig = tor2_spanconfig;
-		s->chanconfig = tor2_chanconfig;
-		s->startup = tor2_startup;
-		s->shutdown = tor2_shutdown;
-		s->rbsbits = tor2_rbsbits;
-		s->maint = tor2_maint;
-		s->open = tor2_open;
-		s->close  = tor2_close;
 		if (tor->cardtype == TYPE_T1) {
 			s->channels = 24;
 			s->deflaw = DAHDI_LAW_MULAW;
@@ -295,7 +299,8 @@
 		}
 		s->chans = tor->chans[x];
 		s->flags = DAHDI_FLAG_RBS;
-		s->ioctl = tor2_ioctl;
+		s->ops = &tor2_span_ops;
+
 		tor->tspans[x].tor = tor;
 		tor->tspans[x].span = x;
 		init_waitqueue_head(&s->maintq);

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c Tue Aug 18 10:01:34 2009
@@ -2294,6 +2294,17 @@
 
 /* internal functions, not specific to the hardware or DAHDI */
 
+static const struct dahdi_span_ops b4xxp_span_ops = {
+	.spanconfig = b4xxp_spanconfig,
+	.chanconfig = b4xxp_chanconfig,
+	.startup = b4xxp_startup,
+	.shutdown = b4xxp_shutdown,
+	.open = b4xxp_open,
+	.close  = b4xxp_close,
+	.ioctl = b4xxp_ioctl,
+	.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit,
+};
+
 /* initialize the span/chan structures. Doesn't touch hardware, although the callbacks might. */
 static void init_spans(struct b4xxp *b4)
 {
@@ -2328,14 +2339,7 @@
 			b4->pdev->bus->number, PCI_SLOT(b4->pdev->devfn) + 1);
 
 		bspan->span.owner = THIS_MODULE;
-		bspan->span.spanconfig = b4xxp_spanconfig;
-		bspan->span.chanconfig = b4xxp_chanconfig;
-		bspan->span.startup = b4xxp_startup;
-		bspan->span.shutdown = b4xxp_shutdown;
-		bspan->span.open = b4xxp_open;
-		bspan->span.close  = b4xxp_close;
-		bspan->span.ioctl = b4xxp_ioctl;
-		bspan->span.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit;
+		bspan->span.ops = &b4xxp_span_ops;
 		if (vpmsupport && CARD_HAS_EC(b4))
 			bspan->span.echocan_create = echocan_create;
 

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcfxo.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcfxo.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcfxo.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcfxo.c Tue Aug 18 10:01:34 2009
@@ -638,6 +638,13 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops wcfxo_span_ops = {
+	.hooksig = wcfxo_hooksig,
+	.open = wcfxo_open,
+	.close = wcfxo_close,
+	.watchdog = wcfxo_watchdog,
+};
+
 static int wcfxo_initialize(struct wcfxo *wc)
 {
 	/* DAHDI stuff */
@@ -653,19 +660,16 @@
 	wc->chan->chanpos = 1;
 	wc->span.chans = &wc->chan;
 	wc->span.channels = 1;
-	wc->span.hooksig = wcfxo_hooksig;
 	wc->span.irq = wc->dev->irq;
-	wc->span.open = wcfxo_open;
-	wc->span.close = wcfxo_close;
 	wc->span.flags = DAHDI_FLAG_RBS;
 	wc->span.deflaw = DAHDI_LAW_MULAW;
-	wc->span.watchdog = wcfxo_watchdog;
 #ifdef ENABLE_TASKLETS
 	tasklet_init(&wc->wcfxo_tlet, wcfxo_tasklet, (unsigned long)wc);
 #endif
 	init_waitqueue_head(&wc->span.maintq);
 
 	wc->chan->pvt = wc;
+	wc->span.ops = &wcfxo_span_ops;
 	if (dahdi_register(&wc->span, 0)) {
 		printk(KERN_NOTICE "Unable to register span with DAHDI\n");
 		return -1;

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct1xxp.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct1xxp.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct1xxp.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct1xxp.c Tue Aug 18 10:01:34 2009
@@ -745,6 +745,19 @@
 
 	return 0;
 }
+
+static const struct dahdi_span_ops t1xxp_span_ops = {
+	.spanconfig = t1xxp_spanconfig,
+	.chanconfig = t1xxp_chanconfig,
+	.startup = t1xxp_startup,
+	.shutdown = t1xxp_shutdown,
+	.rbsbits = t1xxp_rbsbits,
+	.maint = t1xxp_maint,
+	.open = t1xxp_open,
+	.close = t1xxp_close,
+	.ioctl = t1xxp_ioctl,
+};
+
 static int t1xxp_software_init(struct t1xxp *wc)
 {
 	int x;
@@ -765,18 +778,9 @@
 	snprintf(wc->span.location, sizeof(wc->span.location) - 1,
 		 "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 	wc->span.owner = THIS_MODULE;
-	wc->span.spanconfig = t1xxp_spanconfig;
-	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
-	wc->span.startup = t1xxp_startup;
-	wc->span.shutdown = t1xxp_shutdown;
-	wc->span.rbsbits = t1xxp_rbsbits;
-	wc->span.maint = t1xxp_maint;
-	wc->span.open = t1xxp_open;
-	wc->span.close = t1xxp_close;
 	wc->span.chans = wc->chans;
 	wc->span.flags = DAHDI_FLAG_RBS;
-	wc->span.ioctl = t1xxp_ioctl;
 	if (wc->ise1) {
 		wc->span.channels = 31;
 		wc->span.deflaw = DAHDI_LAW_ALAW;
@@ -798,6 +802,7 @@
 		wc->chans[x]->pvt = wc;
 		wc->chans[x]->chanpos = x + 1;
 	}
+	wc->span.ops = &t1xxp_span_ops;
 	if (dahdi_register(&wc->span, 0)) {
 		printk(KERN_NOTICE "Unable to register span with DAHDI\n");
 		return -1;

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c Tue Aug 18 10:01:34 2009
@@ -1586,6 +1586,19 @@
 */
 static unsigned int order_index[16];
 
+static const struct dahdi_span_ops t4_span_ops = {
+	.spanconfig = t4_spanconfig,
+	.chanconfig = t4_chanconfig,
+	.startup = t4_startup,
+	.shutdown = t4_shutdown,
+	.rbsbits = t4_rbsbits,
+	.maint = t4_maint,
+	.open = t4_open,
+	.close  = t4_close,
+	.ioctl = t4_ioctl,
+	.hdlc_hard_xmit = t4_hdlc_hard_xmit,
+};
+
 static void init_spans(struct t4 *wc)
 {
 	int x,y;
@@ -1628,15 +1641,7 @@
 			break;
 		}
 		ts->span.owner = THIS_MODULE;
-		ts->span.spanconfig = t4_spanconfig;
-		ts->span.chanconfig = t4_chanconfig;
 		ts->span.irq = wc->dev->irq;
-		ts->span.startup = t4_startup;
-		ts->span.shutdown = t4_shutdown;
-		ts->span.rbsbits = t4_rbsbits;
-		ts->span.maint = t4_maint;
-		ts->span.open = t4_open;
-		ts->span.close  = t4_close;
 
 		/* HDLC Specific init */
 		ts->sigchan = NULL;
@@ -1654,8 +1659,6 @@
 		}
 		ts->span.chans = ts->chans;
 		ts->span.flags = DAHDI_FLAG_RBS;
-		ts->span.ioctl = t4_ioctl;
-		ts->span.hdlc_hard_xmit = t4_hdlc_hard_xmit;
 		if (gen2) {
 #ifdef VPM_SUPPORT
 			if (vpmsupport)
@@ -1668,6 +1671,9 @@
 		ts->writechunk = (void *)(wc->writechunk + x * 32 * 2);
 		ts->readchunk = (void *)(wc->readchunk + x * 32 * 2);
 		init_waitqueue_head(&ts->span.maintq);
+
+		ts->span.ops = &t4_span_ops;
+
 		for (y=0;y<wc->tspans[x]->span.channels;y++) {
 			struct dahdi_chan *mychans = ts->chans[y];
 			sprintf(mychans->name, "TE%d/%d/%d/%d", wc->numspans, wc->num, x + 1, y + 1);

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm.c Tue Aug 18 10:01:34 2009
@@ -2150,6 +2150,14 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops wctdm_span_ops = {
+	.hooksig = wctdm_hooksig,
+	.open = wctdm_open,
+	.close = wctdm_close,
+	.ioctl = wctdm_ioctl,
+	.watchdog = wctdm_watchdog,
+};
+
 static int wctdm_initialize(struct wctdm *wc)
 {
 	int x;
@@ -2177,14 +2185,10 @@
 	wc->span.owner = THIS_MODULE;
 	wc->span.chans = wc->chans;
 	wc->span.channels = NUM_CARDS;
-	wc->span.hooksig = wctdm_hooksig;
 	wc->span.irq = wc->dev->irq;
-	wc->span.open = wctdm_open;
-	wc->span.close = wctdm_close;
 	wc->span.flags = DAHDI_FLAG_RBS;
-	wc->span.ioctl = wctdm_ioctl;
-	wc->span.watchdog = wctdm_watchdog;
 	init_waitqueue_head(&wc->span.maintq);
+	wc->span.ops = &wctdm_span_ops;
 
 	if (dahdi_register(&wc->span, 0)) {
 		printk(KERN_NOTICE "Unable to register span with DAHDI\n");

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c Tue Aug 18 10:01:34 2009
@@ -3264,6 +3264,14 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops wctdm24xxp_span_ops = {
+	.hooksig = wctdm_hooksig,
+	.open = wctdm_open,
+	.close = wctdm_close,
+	.ioctl = wctdm_ioctl,
+	.watchdog = wctdm_watchdog,
+};
+
 static int wctdm_initialize(struct wctdm *wc)
 {
 	int x;
@@ -3296,13 +3304,9 @@
 	wc->span.chans = wc->chans;
 	wc->span.channels = wc->desc->ports;
 	wc->span.irq = pdev->irq;
-	wc->span.hooksig = wctdm_hooksig;
-	wc->span.open = wctdm_open;
-	wc->span.close = wctdm_close;
 	wc->span.flags = DAHDI_FLAG_RBS;
-	wc->span.ioctl = wctdm_ioctl;
-	wc->span.watchdog = wctdm_watchdog;
 	wc->span.dacs= wctdm_dacs;
+	wc->span.ops = &wctdm24xxp_span_ops;
 #ifdef VPM_SUPPORT
 	if (vpmsupport)
 		wc->span.echocan_create = echocan_create;

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte11xp.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte11xp.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte11xp.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte11xp.c Tue Aug 18 10:01:34 2009
@@ -955,6 +955,18 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops t1xxp_span_ops = {
+	.startup = t1xxp_startup,
+	.shutdown = t1xxp_shutdown,
+	.rbsbits = t1xxp_rbsbits,
+	.maint = t1xxp_maint,
+	.open = t1xxp_open,
+	.close = t1xxp_close,
+	.spanconfig = t1xxp_spanconfig,
+	.chanconfig = t1xxp_chanconfig,
+	.ioctl = t1xxp_ioctl,
+};
+
 static int t1xxp_software_init(struct t1 *wc)
 {
 	int x;
@@ -976,15 +988,7 @@
 	dahdi_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
 	snprintf(wc->span.location, sizeof(wc->span.location) - 1,
 		 "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
-	wc->span.spanconfig = t1xxp_spanconfig;
-	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
-	wc->span.startup = t1xxp_startup;
-	wc->span.shutdown = t1xxp_shutdown;
-	wc->span.rbsbits = t1xxp_rbsbits;
-	wc->span.maint = t1xxp_maint;
-	wc->span.open = t1xxp_open;
-	wc->span.close = t1xxp_close;
 	if (wc->spantype == TYPE_E1) {
 		if (unchannelized)
 			wc->span.channels = 32;
@@ -1001,7 +1005,6 @@
 	}
 	wc->span.chans = wc->chans;
 	wc->span.flags = DAHDI_FLAG_RBS;
-	wc->span.ioctl = t1xxp_ioctl;
 	init_waitqueue_head(&wc->span.maintq);
 	for (x=0;x<wc->span.channels;x++) {
 		sprintf(wc->chans[x]->name, "WCT1/%d/%d", wc->num, x + 1);
@@ -1012,6 +1015,7 @@
 		wc->chans[x]->pvt = wc;
 		wc->chans[x]->chanpos = x + 1;
 	}
+	wc->span.ops = &t1xxp_span_ops;
 	if (dahdi_register(&wc->span, 0)) {
 		printk(KERN_NOTICE "Unable to register span with DAHDI\n");
 		return -1;

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c Tue Aug 18 10:01:34 2009
@@ -1169,6 +1169,18 @@
 	vpmadt032_echocan_free(wc->vpmadt032, chan, ec);
 }
 
+static const struct dahdi_span_ops t1_span_ops = {
+	.spanconfig = t1xxp_spanconfig,
+	.chanconfig = t1xxp_chanconfig,
+	.startup = t1xxp_startup,
+	.shutdown = t1xxp_shutdown,
+	.rbsbits = t1xxp_rbsbits,
+	.maint = t1xxp_maint,
+	.open = t1xxp_open,
+	.close = t1xxp_close,
+	.ioctl = t1xxp_ioctl,
+};
+
 static int t1_software_init(struct t1 *wc)
 {
 	int x;
@@ -1205,16 +1217,7 @@
 		"PCI Bus %02d Slot %02d", dev->bus->number, PCI_SLOT(dev->devfn) + 1);
 
 	wc->span.owner = THIS_MODULE;
-	wc->span.spanconfig = t1xxp_spanconfig;
-	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = dev->irq;
-	wc->span.startup = t1xxp_startup;
-	wc->span.shutdown = t1xxp_shutdown;
-	wc->span.rbsbits = t1xxp_rbsbits;
-	wc->span.maint = t1xxp_maint;
-	wc->span.open = t1xxp_open;
-	wc->span.close = t1xxp_close;
-	wc->span.ioctl = t1xxp_ioctl;
 #ifdef VPM_SUPPORT
 	if (vpmsupport)
 		wc->span.echocan_create = echocan_create;
@@ -1246,6 +1249,7 @@
 		wc->chans[x]->pvt = wc;
 		wc->chans[x]->chanpos = x + 1;
 	}
+	wc->span.ops = &t1_span_ops;
 	if (dahdi_register(&wc->span, 0)) {
 		module_printk("Unable to register span with DAHDI\n");
 		return -1;

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_bri.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_bri.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_bri.c Tue Aug 18 10:01:34 2009
@@ -857,6 +857,27 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops BRI_span_ops = {
+	.spanconfig = bri_spanconfig,
+	.chanconfig = bri_chanconfig,
+	.startup = bri_startup,
+	.shutdown = bri_shutdown,
+#ifndef	CONFIG_DAHDI_BRI_DCHANS
+	.hdlc_hard_xmit = bri_hdlc_hard_xmit,
+#endif
+	.open = xpp_open,
+	.close = xpp_close,
+	.hooksig = xpp_hooksig,	/* Only with RBS bits */
+	.ioctl = xpp_ioctl,
+	.maint = xpp_maint,
+#ifdef	DAHDI_SYNC_TICK
+	.sync_tick = dahdi_sync_tick,
+#endif
+#ifdef	CONFIG_DAHDI_WATCHDOG
+	.watchdog = xpp_watchdog,
+#endif
+};
+
 static int BRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
 {
 	xbus_t			*xbus;
@@ -908,13 +929,7 @@
 		}
 	}
 	CALL_XMETHOD(card_pcm_recompute, xbus, xpd, 0);
-	xpd->span.spanconfig = bri_spanconfig;
-	xpd->span.chanconfig = bri_chanconfig;
-	xpd->span.startup = bri_startup;
-	xpd->span.shutdown = bri_shutdown;
-#ifndef	CONFIG_DAHDI_BRI_DCHANS
-	xpd->span.hdlc_hard_xmit = bri_hdlc_hard_xmit;
-#endif
+	xpd->span.ops = &BRI_span_ops;
 	return 0;
 }
 

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_pri.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_pri.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_pri.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/card_pri.c Tue Aug 18 10:01:34 2009
@@ -998,6 +998,25 @@
 	return 0;
 }
 
+static const struct dahdi_span_ops PRI_span_ops = {
+	.spanconfig = pri_spanconfig,
+	.chanconfig = pri_chanconfig,
+	.startup = pri_startup,
+	.shutdown = pri_shutdown,
+	.rbsbits = pri_rbsbits,
+	.open = xpp_open,
+	.close = xpp_close,
+	.hooksig = xpp_hooksig,	/* Only with RBS bits */
+	.ioctl = xpp_ioctl,
+	.maint = xpp_maint,
+#ifdef	DAHDI_SYNC_TICK
+	.sync_tick = dahdi_sync_tick,
+#endif
+#ifdef	CONFIG_DAHDI_WATCHDOG
+	.watchdog = xpp_watchdog,
+#endif
+};
+
 static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
 {
 	xbus_t			*xbus;
@@ -1039,11 +1058,7 @@
 			cur_chan->sigcap = PRI_BCHAN_SIGCAP;
 	}
 	xpd->offhook_state = xpd->wanted_pcm_mask;
-	xpd->span.spanconfig = pri_spanconfig;
-	xpd->span.chanconfig = pri_chanconfig;
-	xpd->span.startup = pri_startup;
-	xpd->span.shutdown = pri_shutdown;
-	xpd->span.rbsbits = pri_rbsbits;
+	xpd->span.ops = &PRI_span_ops;
 	return 0;
 }
 

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.c?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.c Tue Aug 18 10:01:34 2009
@@ -929,7 +929,7 @@
 	return 0;
 }
 
-static int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
+int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
 {
 	xpd_t	*xpd = chan->pvt;
 	xbus_t	*xbus;
@@ -945,6 +945,7 @@
 	DBG(SIGNAL, "Setting %s to %s (%d)\n", chan->name, txsig2str(txsig), txsig);
 	return CALL_XMETHOD(card_hooksig, xbus, xpd, pos, txsig);
 }
+EXPORT_SYMBOL(xpp_hooksig);
 
 /* Req: Set the requested chunk size.  This is the unit in which you must
    report results for conferencing, etc */
@@ -1078,12 +1079,8 @@
 	span->channels = cn;
 	span->chans = xpd->chans;
 
-	span->open = xpp_open;
-	span->close = xpp_close;
 	span->flags = DAHDI_FLAG_RBS;
-	span->hooksig = xpp_hooksig;	/* Only with RBS bits */
-	span->ioctl = xpp_ioctl;
-	span->maint = xpp_maint;
+
 	/*
 	 * This actually describe the dahdi_spaninfo version 3
 	 * A bunch of unrelated data exported via a modified ioctl()
@@ -1116,12 +1113,6 @@
 	 * No irq's for you today!
 	 */
 	span->irq = 0;
-#ifdef	DAHDI_SYNC_TICK
-	span->sync_tick = dahdi_sync_tick;
-#endif
-#ifdef	CONFIG_DAHDI_WATCHDOG
-	span->watchdog = xpp_watchdog;
-#endif
 
 	snprintf(xpd->span.desc, MAX_SPANDESC, "Xorcom XPD #%02d/%1d%1d: %s",
 			xbus->num, xpd->addr.unit, xpd->addr.subunit, xpd->type_name);

Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.h?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.h (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/xpp/xpp_dahdi.h Tue Aug 18 10:01:34 2009
@@ -39,6 +39,7 @@
 int xpp_open(struct dahdi_chan *chan);
 int xpp_close(struct dahdi_chan *chan);
 int xpp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long arg);
+int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig);
 int xpp_maint(struct dahdi_span *span, int cmd);
 void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd);
 int total_registered_spans(void);

Modified: linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h?view=diff&rev=7035&r1=7034&r2=7035
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h Tue Aug 18 10:01:34 2009
@@ -731,6 +731,70 @@
 #define DAHDI_FLAG_LOOPED	DAHDI_FLAG(LOOPED)
 #define DAHDI_FLAG_MTP2		DAHDI_FLAG(MTP2)
 #define DAHDI_FLAG_HDLC56	DAHDI_FLAG(HDLC56)
+
+struct dahdi_span_ops {
+	/*   ==== Span Callback Operations ====   */
+	/*! Req: Set the requested chunk size.  This is the unit in which you must
+	   report results for conferencing, etc */
+	int (*setchunksize)(struct dahdi_span *span, int chunksize);
+
+	/*! Opt: Configure the span (if appropriate) */
+	int (*spanconfig)(struct dahdi_span *span, struct dahdi_lineconfig *lc);
+	
+	/*! Opt: Start the span */
+	int (*startup)(struct dahdi_span *span);
+	
+	/*! Opt: Shutdown the span */
+	int (*shutdown)(struct dahdi_span *span);
+	
+	/*! Opt: Enable maintenance modes */
+	int (*maint)(struct dahdi_span *span, int mode);
+
+#ifdef	DAHDI_SYNC_TICK
+	/*! Opt: send sync to spans */
+	int (*sync_tick)(struct dahdi_span *span, int is_master);
+#endif
+
+	/* ====  Channel Callback Operations ==== */
+	/*! Opt: Set signalling type (if appropriate) */
+	int (*chanconfig)(struct dahdi_chan *chan, int sigtype);
+
+	/*! Opt: Prepare a channel for I/O */
+	int (*open)(struct dahdi_chan *chan);
+
+	/*! Opt: Close channel for I/O */
+	int (*close)(struct dahdi_chan *chan);
+	
+	/*! Opt: IOCTL */
+	int (*ioctl)(struct dahdi_chan *chan, unsigned int cmd, unsigned long data);
+	
+	/* Okay, now we get to the signalling.  You have several options: */
+
+	/* Option 1: If you're a T1 like interface, you can just provide a
+	   rbsbits function and we'll assert robbed bits for you.  Be sure to 
+	   set the DAHDI_FLAG_RBS in this case.  */
+
+	/*! Opt: If the span uses A/B bits, set them here */
+	int (*rbsbits)(struct dahdi_chan *chan, int bits);
+	
+	/*! Option 2: If you don't know about sig bits, but do have their
+	   equivalents (i.e. you can disconnect battery, detect off hook,
+	   generate ring, etc directly) then you can just specify a
+	   sethook function, and we'll call you with appropriate hook states
+	   to set.  Still set the DAHDI_FLAG_RBS in this case as well */
+	int (*hooksig)(struct dahdi_chan *chan, enum dahdi_txsig hookstate);
+	
+	/*! Option 3: If you can't use sig bits, you can write a function
+	   which handles the individual hook states  */
+	int (*sethook)(struct dahdi_chan *chan, int hookstate);
+	
+	/*! Opt: Used to tell an onboard HDLC controller that there is data ready to transmit */
+	void (*hdlc_hard_xmit)(struct dahdi_chan *chan);
+
+	/*! If the watchdog detects no received data, it will call the
+	   watchdog routine */
+	int (*watchdog)(struct dahdi_span *span, int cause);
+};
 
 struct dahdi_span {
 	spinlock_t lock;
@@ -767,78 +831,19 @@
 
 	struct dahdi_chan **chans;		/*!< Member channel structures */
 
-	/*   ==== Span Callback Operations ====   */
-	/*! Req: Set the requested chunk size.  This is the unit in which you must
-	   report results for conferencing, etc */
-	int (*setchunksize)(struct dahdi_span *span, int chunksize);
-
-	/*! Opt: Configure the span (if appropriate) */
-	int (*spanconfig)(struct dahdi_span *span, struct dahdi_lineconfig *lc);
-	
-	/*! Opt: Start the span */
-	int (*startup)(struct dahdi_span *span);
-	
-	/*! Opt: Shutdown the span */
-	int (*shutdown)(struct dahdi_span *span);
-	
-	/*! Opt: Enable maintenance modes */
-	int (*maint)(struct dahdi_span *span, int mode);
-
-#ifdef	DAHDI_SYNC_TICK
-	/*! Opt: send sync to spans */
-	int (*sync_tick)(struct dahdi_span *span, int is_master);
-#endif
-
-	/* ====  Channel Callback Operations ==== */
-	/*! Opt: Set signalling type (if appropriate) */
-	int (*chanconfig)(struct dahdi_chan *chan, int sigtype);
-
-	/*! Opt: Prepare a channel for I/O */
-	int (*open)(struct dahdi_chan *chan);
-
-	/*! Opt: Close channel for I/O */
-	int (*close)(struct dahdi_chan *chan);
-	
-	/*! Opt: IOCTL */
-	int (*ioctl)(struct dahdi_chan *chan, unsigned int cmd, unsigned long data);
-	
+	/*! Opt: Dacs the contents of chan2 into chan1 if possible */
+	int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
+
 	/*! Opt: Provide echo cancellation on a channel */
 	int (*echocan_create)(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
 			      struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
 
-	/* Okay, now we get to the signalling.  You have several options: */
-
-	/* Option 1: If you're a T1 like interface, you can just provide a
-	   rbsbits function and we'll assert robbed bits for you.  Be sure to 
-	   set the DAHDI_FLAG_RBS in this case.  */
-
-	/*! Opt: If the span uses A/B bits, set them here */
-	int (*rbsbits)(struct dahdi_chan *chan, int bits);
-	
-	/*! Option 2: If you don't know about sig bits, but do have their
-	   equivalents (i.e. you can disconnect battery, detect off hook,
-	   generate ring, etc directly) then you can just specify a
-	   sethook function, and we'll call you with appropriate hook states
-	   to set.  Still set the DAHDI_FLAG_RBS in this case as well */
-	int (*hooksig)(struct dahdi_chan *chan, enum dahdi_txsig hookstate);
-	
-	/*! Option 3: If you can't use sig bits, you can write a function
-	   which handles the individual hook states  */
-	int (*sethook)(struct dahdi_chan *chan, int hookstate);
-	
-	/*! Opt: Dacs the contents of chan2 into chan1 if possible */
-	int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
-
-	/*! Opt: Used to tell an onboard HDLC controller that there is data ready to transmit */
-	void (*hdlc_hard_xmit)(struct dahdi_chan *chan);
-
+	const struct dahdi_span_ops *ops; 	/*!< span callbacks. */
 	/* Used by DAHDI only -- no user servicable parts inside */
 	int spanno;			/*!< Span number for DAHDI */
 	int offset;			/*!< Offset within a given card */
 	int lastalarms;		/*!< Previous alarms */

[... 8 lines stripped ...]



More information about the svn-commits mailing list