dahdi: Save pointer to monitored channel in struct dahdi_chan.

When we're in monitor mode, we can save a pointer to the channel we are
monitoring directly instead of dereferencing the 'chans' array each
time.

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@9604 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-01-03 18:27:53 +00:00
parent 88345e505a
commit 766d0755fd
2 changed files with 7 additions and 2 deletions

View File

@ -2117,6 +2117,7 @@ static void dahdi_chan_unreg(struct dahdi_chan *chan)
pos->_confn = 0; pos->_confn = 0;
pos->confmode = 0; pos->confmode = 0;
pos->dacs_chan = NULL; pos->dacs_chan = NULL;
pos->conf_chan = NULL;
} }
} }
chan->channo = -1; chan->channo = -1;
@ -2719,6 +2720,7 @@ static int initialize_channel(struct dahdi_chan *chan)
if ((chan->sig & __DAHDI_SIG_DACS) != __DAHDI_SIG_DACS) { if ((chan->sig & __DAHDI_SIG_DACS) != __DAHDI_SIG_DACS) {
chan->confna = 0; chan->confna = 0;
chan->confmode = 0; chan->confmode = 0;
chan->conf_chan = NULL;
dahdi_disable_dacs(chan); dahdi_disable_dacs(chan);
} }
chan->_confn = 0; chan->_confn = 0;
@ -5022,6 +5024,7 @@ static int dahdi_ioctl_setconf(struct file *file, unsigned long data)
} }
j = chan->confna; /* save old conference number */ j = chan->confna; /* save old conference number */
chan->confna = conf.confno; /* set conference number */ chan->confna = conf.confno; /* set conference number */
chan->conf_chan = conf_chan;
chan->confmode = conf.confmode; /* set conference mode */ chan->confmode = conf.confmode; /* set conference mode */
chan->_confn = 0; /* Clear confn */ chan->_confn = 0; /* Clear confn */
dahdi_check_conf(j); dahdi_check_conf(j);
@ -5823,6 +5826,7 @@ static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long d
/* initialize conference variables */ /* initialize conference variables */
chan->_confn = 0; chan->_confn = 0;
chan->confna = 0; chan->confna = 0;
chan->conf_chan = NULL;
dahdi_disable_dacs(chan); dahdi_disable_dacs(chan);
chan->confmode = 0; chan->confmode = 0;
chan->confmute = 0; chan->confmute = 0;
@ -6627,8 +6631,8 @@ static inline void __dahdi_process_getaudio_chunk(struct dahdi_chan *ss, unsigne
#endif #endif
if ((!ms->confmute && !ms->dialing) || (is_pseudo_chan(ms))) { if ((!ms->confmute && !ms->dialing) || (is_pseudo_chan(ms))) {
struct dahdi_chan *const conf_chan = ms->conf_chan;
/* Handle conferencing on non-clear channel and non-HDLC channels */ /* Handle conferencing on non-clear channel and non-HDLC channels */
struct dahdi_chan *const conf_chan = chans[ms->confna];
switch(ms->confmode & DAHDI_CONF_MODE_MASK) { switch(ms->confmode & DAHDI_CONF_MODE_MASK) {
case DAHDI_CONF_NORMAL: case DAHDI_CONF_NORMAL:
/* Do nuffin */ /* Do nuffin */
@ -7696,7 +7700,7 @@ static inline void __dahdi_process_putaudio_chunk(struct dahdi_chan *ss, unsigne
/* Take the rxc, twiddle it for conferencing if appropriate and put it /* Take the rxc, twiddle it for conferencing if appropriate and put it
back */ back */
if ((!ms->confmute && !ms->afterdialingtimer) || is_pseudo_chan(ms)) { if ((!ms->confmute && !ms->afterdialingtimer) || is_pseudo_chan(ms)) {
struct dahdi_chan *const conf_chan = chans[ms->confna]; struct dahdi_chan *const conf_chan = ms->conf_chan;
switch(ms->confmode & DAHDI_CONF_MODE_MASK) { switch(ms->confmode & DAHDI_CONF_MODE_MASK) {
case DAHDI_CONF_NORMAL: /* Normal mode */ case DAHDI_CONF_NORMAL: /* Normal mode */
/* Do nothing. rx goes output */ /* Do nothing. rx goes output */

View File

@ -517,6 +517,7 @@ struct dahdi_chan {
int _confn; /*! Actual conference number */ int _confn; /*! Actual conference number */
int confmode; /*! conference mode */ int confmode; /*! conference mode */
int confmute; /*! conference mute mode */ int confmute; /*! conference mute mode */
struct dahdi_chan *conf_chan;
/* Incoming and outgoing conference chunk queues for /* Incoming and outgoing conference chunk queues for
communicating between DAHDI master time and communicating between DAHDI master time and