dahdi: Change dahdi_chan.nextslave from index to a pointer.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9600 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-01-03 18:27:36 +00:00
parent c380e4d91e
commit 8053657761
2 changed files with 20 additions and 20 deletions

View File

@ -4258,11 +4258,11 @@ static void recalc_slaves(struct dahdi_chan *chan)
module_printk(KERN_NOTICE, "Channel %s, slave to %s, last is %s, its next will be %d\n", module_printk(KERN_NOTICE, "Channel %s, slave to %s, last is %s, its next will be %d\n",
chan->span->chans[x]->name, chan->name, last->name, x); chan->span->chans[x]->name, chan->name, last->name, x);
#endif #endif
last->nextslave = x; last->nextslave = chan->span->chans[x];
last = chan->span->chans[x]; last = last->nextslave;
} }
/* Terminate list */ /* Terminate list */
last->nextslave = 0; last->nextslave = NULL;
#ifdef CONFIG_DAHDI_DEBUG #ifdef CONFIG_DAHDI_DEBUG
module_printk(KERN_NOTICE, "Done Recalculating slaves on %s (last is %s)\n", chan->name, last->name); module_printk(KERN_NOTICE, "Done Recalculating slaves on %s (last is %s)\n", chan->name, last->name);
#endif #endif
@ -4345,7 +4345,7 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
/* Clear the master channel */ /* Clear the master channel */
chan->master = chan; chan->master = chan;
chan->nextslave = 0; chan->nextslave = NULL;
/* Unlink this channel from the master's channel list */ /* Unlink this channel from the master's channel list */
recalc_slaves(oldmaster); recalc_slaves(oldmaster);
} }
@ -8538,8 +8538,8 @@ static inline void __dahdi_real_receive(struct dahdi_chan *chan)
int dahdi_transmit(struct dahdi_span *span) int dahdi_transmit(struct dahdi_span *span)
{ {
int x,y,z;
unsigned long flags; unsigned long flags;
unsigned int x;
local_irq_save(flags); local_irq_save(flags);
@ -8562,19 +8562,19 @@ int dahdi_transmit(struct dahdi_span *span)
if (chan->nextslave) { if (chan->nextslave) {
u_char data[DAHDI_CHUNKSIZE]; u_char data[DAHDI_CHUNKSIZE];
int pos = DAHDI_CHUNKSIZE; int pos = DAHDI_CHUNKSIZE;
int y;
struct dahdi_chan *z;
/* Process master/slaves one way */ /* Process master/slaves one way */
for (y = 0; y < DAHDI_CHUNKSIZE; y++) { for (y = 0; y < DAHDI_CHUNKSIZE; y++) {
/* Process slaves for this byte too */ /* Process slaves for this byte too */
z = x; for (z = chan; z; z = z->nextslave) {
do {
if (pos == DAHDI_CHUNKSIZE) { if (pos == DAHDI_CHUNKSIZE) {
/* Get next chunk */ /* Get next chunk */
__dahdi_transmit_chunk(chan, data); __dahdi_transmit_chunk(chan, data);
pos = 0; pos = 0;
} }
span->chans[z]->writechunk[y] = data[pos++]; z->writechunk[y] = data[pos++];
z = span->chans[z]->nextslave; }
} while(z);
} }
} else { } else {
/* Process independents elsewise */ /* Process independents elsewise */
@ -8839,8 +8839,8 @@ static void coretimer_cleanup(void)
int dahdi_receive(struct dahdi_span *span) int dahdi_receive(struct dahdi_span *span)
{ {
int x,y,z;
unsigned long flags; unsigned long flags;
unsigned int x;
#ifdef CONFIG_DAHDI_WATCHDOG #ifdef CONFIG_DAHDI_WATCHDOG
span->watchcounter--; span->watchcounter--;
@ -8855,18 +8855,18 @@ int dahdi_receive(struct dahdi_span *span)
/* Must process each slave at the same time */ /* Must process each slave at the same time */
u_char data[DAHDI_CHUNKSIZE]; u_char data[DAHDI_CHUNKSIZE];
int pos = 0; int pos = 0;
int y;
struct dahdi_chan *z;
for (y=0;y<DAHDI_CHUNKSIZE;y++) { for (y=0;y<DAHDI_CHUNKSIZE;y++) {
/* Put all its slaves, too */ /* Put all its slaves, too */
z = x; for (z = chan; z; z = z->nextslave) {
do { data[pos++] = z->readchunk[y];
data[pos++] = span->chans[z]->readchunk[y];
if (pos == DAHDI_CHUNKSIZE) { if (pos == DAHDI_CHUNKSIZE) {
if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX)) if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX))
__dahdi_receive_chunk(chan, data); __dahdi_receive_chunk(chan, data);
pos = 0; pos = 0;
} }
z=span->chans[z]->nextslave; }
} while(z);
} }
} else { } else {
/* Process a normal channel */ /* Process a normal channel */

View File

@ -424,7 +424,7 @@ struct dahdi_chan {
struct dahdi_chan *master; /*!< Our Master channel (could be us) */ struct dahdi_chan *master; /*!< Our Master channel (could be us) */
/*! \brief Next slave (if appropriate) */ /*! \brief Next slave (if appropriate) */
int nextslave; struct dahdi_chan *nextslave;
u_char *writechunk; /*!< Actual place to write to */ u_char *writechunk; /*!< Actual place to write to */
u_char swritechunk[DAHDI_MAX_CHUNKSIZE]; /*!< Buffer to be written */ u_char swritechunk[DAHDI_MAX_CHUNKSIZE]; /*!< Buffer to be written */