From 766d0755fd295d3861708c7b6bc82075b1626122 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 3 Jan 2011 18:27:53 +0000 Subject: [PATCH] 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 Acked-by: Kinsey Moore git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9604 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 8 ++++++-- include/dahdi/kernel.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index e45e185..eefac90 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -2117,6 +2117,7 @@ static void dahdi_chan_unreg(struct dahdi_chan *chan) pos->_confn = 0; pos->confmode = 0; pos->dacs_chan = NULL; + pos->conf_chan = NULL; } } chan->channo = -1; @@ -2719,6 +2720,7 @@ static int initialize_channel(struct dahdi_chan *chan) if ((chan->sig & __DAHDI_SIG_DACS) != __DAHDI_SIG_DACS) { chan->confna = 0; chan->confmode = 0; + chan->conf_chan = NULL; dahdi_disable_dacs(chan); } 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 */ chan->confna = conf.confno; /* set conference number */ + chan->conf_chan = conf_chan; chan->confmode = conf.confmode; /* set conference mode */ chan->_confn = 0; /* Clear confn */ 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 */ chan->_confn = 0; chan->confna = 0; + chan->conf_chan = NULL; dahdi_disable_dacs(chan); chan->confmode = 0; chan->confmute = 0; @@ -6627,8 +6631,8 @@ static inline void __dahdi_process_getaudio_chunk(struct dahdi_chan *ss, unsigne #endif 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 */ - struct dahdi_chan *const conf_chan = chans[ms->confna]; switch(ms->confmode & DAHDI_CONF_MODE_MASK) { case DAHDI_CONF_NORMAL: /* 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 back */ 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) { case DAHDI_CONF_NORMAL: /* Normal mode */ /* Do nothing. rx goes output */ diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 9f74d89..6a069b5 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -517,6 +517,7 @@ struct dahdi_chan { int _confn; /*! Actual conference number */ int confmode; /*! conference mode */ int confmute; /*! conference mute mode */ + struct dahdi_chan *conf_chan; /* Incoming and outgoing conference chunk queues for communicating between DAHDI master time and