[svn-commits] sruffell: linux/trunk r8984 - in /linux/trunk: drivers/dahdi/ drivers/dahdi/w...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Jul 25 19:30:51 CDT 2010
Author: sruffell
Date: Sun Jul 25 19:30:39 2010
New Revision: 8984
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8984
Log:
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.
Modified:
linux/trunk/drivers/dahdi/dahdi_dummy.c
linux/trunk/drivers/dahdi/dahdi_dynamic.c
linux/trunk/drivers/dahdi/pciradio.c
linux/trunk/drivers/dahdi/tor2.c
linux/trunk/drivers/dahdi/wcb4xxp/base.c
linux/trunk/drivers/dahdi/wcfxo.c
linux/trunk/drivers/dahdi/wct1xxp.c
linux/trunk/drivers/dahdi/wct4xxp/base.c
linux/trunk/drivers/dahdi/wctdm.c
linux/trunk/drivers/dahdi/wctdm24xxp/base.c
linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.h
linux/trunk/drivers/dahdi/wcte11xp.c
linux/trunk/drivers/dahdi/wcte12xp/base.c
linux/trunk/drivers/dahdi/xpp/card_bri.c
linux/trunk/drivers/dahdi/xpp/card_pri.c
linux/trunk/drivers/dahdi/xpp/xbus-pcm.c
linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c
linux/trunk/include/dahdi/kernel.h
Modified: linux/trunk/drivers/dahdi/dahdi_dummy.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dummy.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dummy.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dummy.c Sun Jul 25 19:30:39 2010
@@ -213,7 +213,6 @@
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;
if (dahdi_register(&ztd->span, 0)) {
return -1;
Modified: linux/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Sun Jul 25 19:30:39 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)
@@ -584,7 +587,6 @@
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;
Modified: linux/trunk/drivers/dahdi/pciradio.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/pciradio.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/pciradio.c (original)
+++ linux/trunk/drivers/dahdi/pciradio.c Sun Jul 25 19:30:39 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;
}
@@ -1486,7 +1486,6 @@
rad->span.watchdog = pciradio_watchdog;
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/trunk/drivers/dahdi/tor2.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/tor2.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/tor2.c (original)
+++ linux/trunk/drivers/dahdi/tor2.c Sun Jul 25 19:30:39 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);
@@ -264,47 +264,47 @@
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;
+ 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) {
- 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->ioctl = tor2_ioctl;
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 +315,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 +628,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 +668,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 +763,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 +772,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 +809,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 +1012,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 +1075,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 +1145,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 +1176,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 +1226,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 +1246,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 +1255,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 +1272,16 @@
for (k = 1; k <= SPANS_PER_CARD; k++) {
c = t1in(tor,k,0x31 + j);
rxc = c & 15;
- if (rxc != tor->spans[k - 1].chans[j + 16]->rxsig) {
+ if (rxc != tor->tspans[k - 1].dahdi_span.chans[j + 16]->rxsig) {
/* Check for changes in received bits */
- if (!(tor->spans[k - 1].chans[j + 16]->sig & DAHDI_SIG_CLEAR))
- dahdi_rbsbits(tor->spans[k - 1].chans[j + 16], rxc);
+ if (!(tor->tspans[k - 1].dahdi_span.chans[j + 16]->sig & DAHDI_SIG_CLEAR))
+ dahdi_rbsbits(tor->tspans[k - 1].dahdi_span.chans[j + 16], rxc);
}
rxc = c >> 4;
- if (rxc != tor->spans[k - 1].chans[j]->rxsig) {
+ if (rxc != tor->tspans[k - 1].dahdi_span.chans[j]->rxsig) {
/* Check for changes in received bits */
- if (!(tor->spans[k - 1].chans[j]->sig & DAHDI_SIG_CLEAR))
- dahdi_rbsbits(tor->spans[k - 1].chans[j], rxc);
+ if (!(tor->tspans[k - 1].dahdi_span.chans[j]->sig & DAHDI_SIG_CLEAR))
+ dahdi_rbsbits(tor->tspans[k - 1].dahdi_span.chans[j], rxc);
}
}
}
@@ -1296,11 +1299,10 @@
rxc = 0;
if (abits & (1 << j)) rxc |= DAHDI_ABIT;
if (bbits & (1 << j)) rxc |= DAHDI_BBIT;
- if (tor->spans[k].chans[i]->rxsig != rxc) {
+ if (tor->tspans[k].dahdi_span.chans[i]->rxsig != rxc) {
/* Check for changes in received bits */
- if (!(tor->spans[k].chans[i]->sig & DAHDI_SIG_CLEAR)) {
- dahdi_rbsbits(tor->spans[k].chans[i], rxc);
- }
+ if (!(tor->tspans[k].dahdi_span.chans[i]->sig & DAHDI_SIG_CLEAR))
+ dahdi_rbsbits(tor->tspans[k].dahdi_span.chans[i], rxc);
}
}
}
@@ -1310,12 +1312,12 @@
if (tor->alarmtimer[i]) {
if (!--tor->alarmtimer[i]) {
/* clear recover status */
- tor->spans[i].alarms &= ~DAHDI_ALARM_RECOVER;
+ tor->tspans[i].dahdi_span.alarms &= ~DAHDI_ALARM_RECOVER;
if (tor->cardtype == TYPE_E1)
t1out(tor,i + 1,0x21,0x5f); /* turn off yel */
else
t1out(tor,i + 1,0x35,0x10); /* turn off yel */
- dahdi_alarm_notify(&tor->spans[i]); /* let them know */
+ dahdi_alarm_notify(&tor->tspans[i].dahdi_span); /* let them know */
}
}
}
@@ -1327,31 +1329,31 @@
i -= 10;
if (tor->cardtype == TYPE_T1) {
c = t1in(tor,i + 1,0x31); /* get RIR2 */
- tor->spans[i].rxlevel = c >> 6; /* get rx level */
+ tor->tspans[i].dahdi_span.rxlevel = c >> 6; /* get rx level */
t1out(tor,i + 1,0x20,0xff);
c = t1in(tor,i + 1,0x20); /* get the status */
/* detect the code, only if we are not sending one */
- if ((!tor->spans[i].mainttimer) && (c & 0x80)) /* if loop-up code detected */
+ if ((!tor->tspans[i].dahdi_span.mainttimer) && (c & 0x80)) /* if loop-up code detected */
{
/* set into remote loop, if not there already */
if ((tor->loopupcnt[i]++ > 80) &&
- (tor->spans[i].maintstat != DAHDI_MAINT_REMOTELOOP))
+ (tor->tspans[i].dahdi_span.maintstat != DAHDI_MAINT_REMOTELOOP))
{
t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(tor,i + 1,0x0a,0x40); /* remote loop */
- tor->spans[i].maintstat = DAHDI_MAINT_REMOTELOOP;
+ tor->tspans[i].dahdi_span.maintstat = DAHDI_MAINT_REMOTELOOP;
}
} else tor->loopupcnt[i] = 0;
/* detect the code, only if we are not sending one */
- if ((!tor->spans[i].mainttimer) && (c & 0x40)) /* if loop-down code detected */
+ if ((!tor->tspans[i].dahdi_span.mainttimer) && (c & 0x40)) /* if loop-down code detected */
{
/* if in remote loop, get out of it */
if ((tor->loopdowncnt[i]++ > 80) &&
- (tor->spans[i].maintstat == DAHDI_MAINT_REMOTELOOP))
+ (tor->tspans[i].dahdi_span.maintstat == DAHDI_MAINT_REMOTELOOP))
{
t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(tor,i + 1,0x0a,0); /* no remote loop */
- tor->spans[i].maintstat = DAHDI_MAINT_NONE;
+ tor->tspans[i].dahdi_span.maintstat = DAHDI_MAINT_NONE;
}
} else tor->loopdowncnt[i] = 0;
if (c & 3) /* if red alarm */
@@ -1375,29 +1377,27 @@
}
}
/* only consider previous carrier alarm state */
- tor->spans[i].alarms &= (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_NOTOPEN);
+ tor->tspans[i].dahdi_span.alarms &= (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_NOTOPEN);
n = 1; /* set to 1 so will not be in yellow alarm if we dont
care about open channels */
- /* if to have yellow alarm if nothing open */
- if (tor->spans[i].lineconfig & DAHDI_CONFIG_NOTOPEN)
- {
- /* go thru all chans, and count # open */
- for (n = 0,k = 0; k < tor->spans[i].channels; k++)
- {
+ /* if to have yellow alarm if nothing open */
+ if (tor->tspans[i].dahdi_span.lineconfig & DAHDI_CONFIG_NOTOPEN) {
+ /* go thru all chans, and count # open */
+ for (n = 0, k = 0; k < tor->tspans[i].dahdi_span.channels; k++) {
if (((tor->chans[i][k])->flags & DAHDI_FLAG_OPEN) ||
- ((tor->chans[i][k])->flags & DAHDI_FLAG_NETDEV)) n++;
- }
- /* if none open, set alarm condition */
- if (!n) j |= DAHDI_ALARM_NOTOPEN;
- }
+ ((tor->chans[i][k])->flags & DAHDI_FLAG_NETDEV))
+ n++;
+ }
+ /* if none open, set alarm condition */
+ if (!n)
+ j |= DAHDI_ALARM_NOTOPEN;
+ }
/* if no more alarms, and we had some */
- if ((!j) && tor->spans[i].alarms)
- {
+ if ((!j) && tor->tspans[i].dahdi_span.alarms)
tor->alarmtimer[i] = DAHDI_ALARMSETTLE_TIME;
- }
if (tor->alarmtimer[i]) j |= DAHDI_ALARM_RECOVER;
/* if going into alarm state, set yellow alarm */
- if ((j) && (!tor->spans[i].alarms)) {
+ if ((j) && (!tor->tspans[i].dahdi_span.alarms)) {
if (tor->cardtype == TYPE_E1)
t1out(tor,i + 1,0x21,0x7f);
else
@@ -1405,18 +1405,19 @@
}
if (c & 4) /* if yellow alarm */
j |= DAHDI_ALARM_YELLOW;
- if (tor->spans[i].maintstat || tor->spans[i].mainttimer) j |= DAHDI_ALARM_LOOPBACK;
- tor->spans[i].alarms = j;
+ if (tor->tspans[i].dahdi_span.maintstat || tor->tspans[i].dahdi_span.mainttimer)
+ j |= DAHDI_ALARM_LOOPBACK;
+ tor->tspans[i].dahdi_span.alarms = j;
c = (LEDRED | LEDGREEN) << (2 * i);
tor->leds &= ~c; /* mask out bits for this span */
/* light LED's if span configured and running */
- if (tor->spans[i].flags & DAHDI_FLAG_RUNNING) {
+ if (tor->tspans[i].dahdi_span.flags & DAHDI_FLAG_RUNNING) {
if (j & DAHDI_ALARM_RED) tor->leds |= LEDRED << (2 * i);
else if (j & DAHDI_ALARM_YELLOW) tor->leds |= (LEDRED | LEDGREEN) << (2 * i);
else tor->leds |= LEDGREEN << (2 * i);
}
tor->mem8[LEDREG] = tor->leds;
- dahdi_alarm_notify(&tor->spans[i]);
+ dahdi_alarm_notify(&tor->tspans[i].dahdi_span);
}
if (!(tor->passno % 1000)) /* even second boundary */
{
@@ -1426,26 +1427,26 @@
if (tor->cardtype == TYPE_E1)
{
/* add this second's BPV count to total one */
- tor->spans[i - 1].count.bpv +=
+ tor->tspans[i - 1].dahdi_span.count.bpv +=
t1in(tor, i, 1) + (t1in(tor, i, 0)<<8);
- if (tor->spans[i - 1].lineconfig & DAHDI_CONFIG_CRC4)
+ if (tor->tspans[i - 1].dahdi_span.lineconfig & DAHDI_CONFIG_CRC4)
{
- tor->spans[i - 1].count.crc4 +=
+ tor->tspans[i - 1].dahdi_span.count.crc4 +=
t1in(tor, i, 3) +
((t1in(tor, i, 2) & 3) << 8);
- tor->spans[i - 1].count.ebit +=
+ tor->tspans[i - 1].dahdi_span.count.ebit +=
t1in(tor, i, 5) +
((t1in(tor, i, 4) & 3) << 8);
}
- tor->spans[i - 1].count.fas +=
+ tor->tspans[i - 1].dahdi_span.count.fas +=
(t1in(tor, i, 4) >> 2) +
((t1in(tor, i, 2) & 0x3F) << 6);
}
else
{
/* add this second's BPV count to total one */
- tor->spans[i - 1].count.bpv +=
+ tor->tspans[i - 1].dahdi_span.count.bpv +=
t1in(tor, i, 0x24) +
(t1in(tor, i, 0x23) << 8);
}
@@ -1459,7 +1460,7 @@
if (tor->psyncs[0])
{
/* if no alarms, use it */
- if (!(tor->spans[tor->psyncs[0] - 1].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
+ if (!(tor->tspans[tor->psyncs[0] - 1].dahdi_span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
DAHDI_ALARM_LOOPBACK))) {
tor->syncsrc = tor->psyncs[0];
newsyncsrc = tor->syncs[0];
@@ -1470,7 +1471,7 @@
/* if we dont have one yet, and there is one specified at this level, see if we can use it */
if ((!tor->syncsrc) && (tor->psyncs[i])) {
/* if no alarms, use it */
- if (!(tor->spans[tor->psyncs[i] - 1].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
+ if (!(tor->tspans[tor->psyncs[i] - 1].dahdi_span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
DAHDI_ALARM_LOOPBACK))) {
tor->syncsrc = tor->psyncs[i];
newsyncsrc = tor->syncs[i];
@@ -1478,7 +1479,8 @@
}
}
/* update sync src info */
- for (i = 0; i < SPANS_PER_CARD; i++) tor->spans[i].syncsrc = newsyncsrc;
+ for (i = 0; i < SPANS_PER_CARD; i++)
+ tor->tspans[i].dahdi_span.syncsrc = newsyncsrc;
/* actually set the sync register */
tor->mem8[SYNCREG] = tor->syncsrc;
Modified: linux/trunk/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcb4xxp/base.c Sun Jul 25 19:30:39 2010
@@ -2088,7 +2088,7 @@
static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
- struct b4xxp_span *bspan = chan->span->pvt;
+ struct b4xxp_span *bspan = container_of(chan->span, struct b4xxp_span, span);
int channel;
if (chan->chanpos == 3) {
@@ -2117,7 +2117,7 @@
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
{
- struct b4xxp_span *bspan = chan->span->pvt;
+ struct b4xxp_span *bspan = container_of(chan->span, struct b4xxp_span, span);
int channel;
memset(ec, 0, sizeof(*ec));
@@ -2145,7 +2145,7 @@
static int b4xxp_startup(struct dahdi_span *span)
{
- struct b4xxp_span *bspan = span->pvt;
+ struct b4xxp_span *bspan = container_of(span, struct b4xxp_span, span);
struct b4xxp *b4 = bspan->parent;
if (!b4->running)
@@ -2156,7 +2156,7 @@
static int b4xxp_shutdown(struct dahdi_span *span)
{
- struct b4xxp_span *bspan = span->pvt;
+ struct b4xxp_span *bspan = container_of(span, struct b4xxp_span, span);
hfc_disable_interrupts(bspan->parent);
return 0;
@@ -2179,7 +2179,7 @@
static int b4xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
{
int i;
- struct b4xxp_span *bspan = span->pvt;
+ struct b4xxp_span *bspan = container_of(span, struct b4xxp_span, span);
struct b4xxp *b4 = bspan->parent;
if (DBG)
@@ -2322,7 +2322,6 @@
bspan->parent = b4;
bspan->span.irq = b4->pdev->irq;
- bspan->span.pvt = bspan;
bspan->span.spantype = (bspan->te_mode) ? "TE" : "NT";
bspan->span.offset = i;
bspan->span.channels = WCB4XXP_CHANNELS_PER_SPAN;
Modified: linux/trunk/drivers/dahdi/wcfxo.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcfxo.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wcfxo.c (original)
+++ linux/trunk/drivers/dahdi/wcfxo.c Sun Jul 25 19:30:39 2010
@@ -564,6 +564,11 @@
return -1;
}
+static inline struct wcfxo *wcfxo_from_span(struct dahdi_span *span)
+{
+ return container_of(span, struct wcfxo, span);
+}
+
static int wcfxo_open(struct dahdi_chan *chan)
{
struct wcfxo *wc = chan->pvt;
@@ -576,7 +581,7 @@
static int wcfxo_watchdog(struct dahdi_span *span, int event)
{
printk(KERN_INFO "FXO: Restarting DMA\n");
- wcfxo_restart_dma(span->pvt);
+ wcfxo_restart_dma(wcfxo_from_span(span));
return 0;
}
@@ -660,7 +665,6 @@
#endif
init_waitqueue_head(&wc->span.maintq);
- wc->span.pvt = wc;
wc->chan->pvt = wc;
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
Modified: linux/trunk/drivers/dahdi/wct1xxp.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct1xxp.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wct1xxp.c (original)
+++ linux/trunk/drivers/dahdi/wct1xxp.c Sun Jul 25 19:30:39 2010
@@ -604,9 +604,14 @@
}
}
+static inline struct t1xxp *t1xxp_from_span(struct dahdi_span *span)
+{
+ return container_of(span, struct t1xxp, span);
+}
+
static int t1xxp_startup(struct dahdi_span *span)
{
- struct t1xxp *wc = span->pvt;
+ struct t1xxp *wc = t1xxp_from_span(span);
int i,alreadyrunning = span->flags & DAHDI_FLAG_RUNNING;
@@ -637,7 +642,7 @@
static int t1xxp_shutdown(struct dahdi_span *span)
{
- struct t1xxp *wc = span->pvt;
+ struct t1xxp *wc = t1xxp_from_span(span);
unsigned long flags;
spin_lock_irqsave(&wc->lock, flags);
@@ -652,7 +657,7 @@
static int t1xxp_maint(struct dahdi_span *span, int cmd)
{
- struct t1xxp *wc = span->pvt;
+ struct t1xxp *wc = t1xxp_from_span(span);
int res = 0;
unsigned long flags;
spin_lock_irqsave(&wc->lock, flags);
@@ -730,7 +735,7 @@
static int t1xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
{
- struct t1xxp *wc = span->pvt;
+ struct t1xxp *wc = t1xxp_from_span(span);
/* Do we want to SYNC on receive or not */
wc->sync = (lc->sync) ? 1 : 0;
@@ -772,7 +777,6 @@
wc->span.chans = wc->chans;
wc->span.flags = DAHDI_FLAG_RBS;
wc->span.ioctl = t1xxp_ioctl;
- wc->span.pvt = wc;
if (wc->ise1) {
wc->span.channels = 31;
wc->span.deflaw = DAHDI_LAW_ALAW;
Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Sun Jul 25 19:30:39 2010
@@ -1236,7 +1236,7 @@
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct t4 *wc = chan->pvt;
- struct t4_span *tspan = chan->span->pvt;
+ struct t4_span *tspan = container_of(chan->span, struct t4_span, span);
int channel;
const struct dahdi_echocan_ops *ops;
const struct dahdi_echocan_features *features;
@@ -1434,7 +1434,7 @@
static int t4_maint(struct dahdi_span *span, int cmd)
{
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
unsigned int reg;
@@ -1556,7 +1556,7 @@
static int t4_clear_maint(struct dahdi_span *span)
{
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
unsigned int reg;
@@ -1583,7 +1583,7 @@
static int t4_reset_counters(struct dahdi_span *span)
{
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
memset(&ts->span.count, 0, sizeof(ts->span.count));
return 0;
}
@@ -1647,7 +1647,7 @@
int tspan;
int wasrunning;
unsigned long flags;
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
tspan = span->offset + 1;
@@ -1697,7 +1697,7 @@
static int t4_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
{
int i;
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
printk(KERN_INFO "About to enter spanconfig!\n");
@@ -1913,7 +1913,6 @@
#endif
ts->span.dacs = t4_dacs;
}
- ts->span.pvt = ts;
ts->owner = wc;
ts->span.offset = x;
init_waitqueue_head(&ts->span.maintq);
@@ -2374,7 +2373,7 @@
int tspan;
unsigned long flags;
int alreadyrunning;
- struct t4_span *ts = span->pvt;
+ struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
set_bit(T4_IGNORE_LATENCY, &wc->checkflag);
Modified: linux/trunk/drivers/dahdi/wctdm.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm.c (original)
+++ linux/trunk/drivers/dahdi/wctdm.c Sun Jul 25 19:30:39 2010
@@ -2088,10 +2088,15 @@
return 0;
}
+static inline struct wctdm *wctdm_from_span(struct dahdi_span *span)
+{
+ return container_of(span, struct wctdm, span);
+}
+
static int wctdm_watchdog(struct dahdi_span *span, int event)
{
printk(KERN_INFO "TDM: Restarting DMA\n");
- wctdm_restart_dma(span->pvt);
+ wctdm_restart_dma(wctdm_from_span(span));
return 0;
}
@@ -2365,7 +2370,6 @@
wc->span.watchdog = wctdm_watchdog;
init_waitqueue_head(&wc->span.maintq);
- wc->span.pvt = wc;
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Sun Jul 25 19:30:39 2010
@@ -3312,9 +3312,15 @@
return 0;
}
+static inline struct wctdm *span_to_wctdm(struct dahdi_span *span)
+{
+ struct wctdm_span *s = container_of(span, struct wctdm_span, span);
+ return s->wc;
+}
+
static int wctdm_watchdog(struct dahdi_span *span, int event)
{
- struct wctdm *wc = span->pvt;
+ struct wctdm *wc = span_to_wctdm(span);
dev_info(&wc->vb.pdev->dev, "TDM: Called watchdog\n");
return 0;
}
@@ -3609,6 +3615,7 @@
s->span.offset = spanno;
s->spanno = spancount++;
+ s->wc = wc;
/* Do not change the procfs representation for non-hx8 cards. */
if (digital_span)
@@ -4787,7 +4794,6 @@
return -EIO;
}
b4 = wc->mods[i].bri;
- b400m_set_dahdi_span(b4, i & 0x03, &wc->spans[curspan]->span);
++curspan;
curchan += 3;
@@ -4822,7 +4828,6 @@
wctdm_init_span(wc, curspan, curchan, wc->desc->ports, 0);
wctdm_fixup_analog_span(wc, curspan);
wc->aspan = wc->spans[curspan];
- wc->aspan->span.pvt = wc;
curchan += wc->desc->ports;
++curspan;
}
Modified: linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Sun Jul 25 19:30:39 2010
@@ -155,6 +155,7 @@
struct dahdi_span span;
int timing_priority;
int spanno;
+ struct wctdm *wc;
};
struct wctdm_chan {
Modified: linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c?view=diff&rev=8984&r1=8983&r2=8984
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c Sun Jul 25 19:30:39 2010
@@ -550,7 +550,7 @@
int fifos[B400M_CHANNELS_PER_SPAN]; /* B1, B2, D <--> host fifo numbers */
/* HDLC controller fields */
- struct dahdi_span *span; /* pointer to the actual dahdi_span */
+ struct dahdi_span span; /* The actual dahdi_span */
struct dahdi_chan *sigchan; /* pointer to the signalling channel for this span */
int sigactive; /* nonzero means we're in the middle of sending an HDLC frame */
atomic_t hdlc_pending; /* hdlc_hard_xmit() increments, hdlc_tx_frame() decrements */
@@ -602,13 +602,6 @@
static void hfc_start_st(struct b400m_span *s);
static void hfc_stop_st(struct b400m_span *s);
-
-void b400m_set_dahdi_span(struct b400m *b4, int spanno,
- struct dahdi_span *span)
-{
- span->pvt = &b4->spans[spanno];
- b4->spans[spanno].span = span;
-}
static inline void flush_hw(void)
{
@@ -1446,11 +1439,11 @@
hfc_timer_expire(s, j);
}
- if (s->span && s->newalarm != s->span->alarms &&
+ if (s->newalarm != s->span.alarms &&
time_after_eq(b4->ticks, s->alarmtimer)) {
- s->span->alarms = s->newalarm;
+ s->span.alarms = s->newalarm;
if ((!s->newalarm && bri_teignorered) || (!bri_teignorered))
- dahdi_alarm_notify(s->span);
+ dahdi_alarm_notify(&s->span);
if (DBG_ALARM) {
dev_info(&b4->wc->vb.pdev->dev, "span %d: alarm " \
@@ -1610,9 +1603,9 @@
b400m_setreg_ra(b4, R_SU_SEL, s->port, A_SU_WR_STA, V_SU_LD_STA);
flush_hw(); /* make sure write hit hardware */
- s->span->alarms = DAHDI_ALARM_RED;
+ s->span.alarms = DAHDI_ALARM_RED;
s->newalarm = DAHDI_ALARM_RED;
- dahdi_alarm_notify(s->span);
+ dahdi_alarm_notify(&s->span);
/* set up the clock control register. Must be done before we activate
* the interface. */
@@ -2060,7 +2053,7 @@
static int xhfc_startup(struct dahdi_span *span)
{
- struct b400m_span *bspan = span->pvt;
+ struct b400m_span *bspan = container_of(span, struct b400m_span, span);
struct b400m *b4 = bspan->parent;
if (!b4->running)
hfc_enable_interrupts(bspan->parent);
@@ -2177,7 +2170,7 @@
int te_mode, term;
int pos;
- bspan = span->pvt;
+ bspan = container_of(span, struct b400m_span, span);
b4 = bspan->parent;
wc = b4->wc;
@@ -2218,7 +2211,6 @@
wc->spans[pos]->timing_priority = lc->sync;
- bspan->span = span;
xhfc_reset_span(bspan);
/* call startup() manually here, because DAHDI won't call the startup
@@ -2247,11 +2239,11 @@
int b400m_chanconfig(struct dahdi_chan *chan, int sigtype)
{
int alreadyrunning;
- struct b400m_span *bspan = chan->span->pvt;
+ struct b400m_span *bspan = container_of(chan->span, struct b400m_span, span);
struct b400m *b4 = bspan->parent;
int res;
- alreadyrunning = bspan->span->flags & DAHDI_FLAG_RUNNING;
[... 294 lines stripped ...]
More information about the svn-commits
mailing list