From 08d3ff5671a73046ea675a24b573d65335ad401f Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Fri, 19 Nov 2010 17:34:42 +0000 Subject: [PATCH] dahdi: Fixup prior dahdi_mirror patch Reworking tsearle's patch to fit with coding guidelines and make process_masterspan a bit easier to read. (closes issue #16831) Reported by: tsearle Signed-off-by: Russ Meyerriecks Acked-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9494 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 368b049..59dddf1 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8469,6 +8469,28 @@ int dahdi_transmit(struct dahdi_span *span) return 0; } +static inline void __pseudo_rx_audio(struct dahdi_chan *chan) +{ + unsigned char tmp[DAHDI_CHUNKSIZE]; + spin_lock(&chan->lock); + __dahdi_getempty(chan, tmp); + __dahdi_receive_chunk(chan, tmp); + spin_unlock(&chan->lock); +} + +#ifdef CONFIG_DAHDI_MIRROR +static inline void pseudo_rx_audio(struct dahdi_chan *chan) +{ + if (!chan->srcmirror) + __pseudo_rx_audio(chan); +} +#else +static inline void pseudo_rx_audio(struct dahdi_chan *chan) +{ + __pseudo_rx_audio(chan); +} +#endif /* CONFIG_DAHDI_MIRROR */ + static void process_masterspan(void) { unsigned long flags; @@ -8526,19 +8548,7 @@ static void process_masterspan(void) /* do all the pseudo/conferenced channel transmits (putbuf's) */ list_for_each_entry(pseudo, &pseudo_chans, node) { - unsigned char tmp[DAHDI_CHUNKSIZE]; - spin_lock(&pseudo->chan.lock); -#ifdef CONFIG_DAHDI_MIRROR - // if this is a mirroring don't generate garbage - if(!pseudo->chan.srcmirror) - { -#endif /* CONFIG_DAHDI_MIRROR */ - __dahdi_getempty(&pseudo->chan, tmp); - __dahdi_receive_chunk(&pseudo->chan, tmp); -#ifdef CONFIG_DAHDI_MIRROR - } -#endif /* CONFIG_DAHDI_MIRROR */ - spin_unlock(&pseudo->chan.lock); + pseudo_rx_audio(&pseudo->chan); } for (y = 1; y < maxspans; ++y) {