From 40e0183721b4dd08ff25b14cc4dd088577436280 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 3 Jan 2011 18:27:44 +0000 Subject: dahdi: Only check for NOSTDTXRX once in dahdi_receive. There is no need to check the flag on the master channel when processing all the slave channels. Originally part of a patch kpfleming had floating around. Signed-off-by: Shaun Ruffell Signed-off-by: Kevin P. Fleming Acked-by: Kinsey Moore git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9602 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index c27d28f..d40408e 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8849,8 +8849,12 @@ int dahdi_receive(struct dahdi_span *span) for (x = 0; x < span->channels; x++) { struct dahdi_chan *const chan = span->chans[x]; + spin_lock(&chan->lock); + if (unlikely(chan->flags & DAHDI_FLAG_NOSTDTXRX)) { + spin_unlock(&chan->lock); + continue; + } if (chan->master == chan) { - spin_lock(&chan->lock); if (chan->nextslave) { /* Must process each slave at the same time */ u_char data[DAHDI_CHUNKSIZE]; @@ -8862,16 +8866,14 @@ int dahdi_receive(struct dahdi_span *span) for (z = chan; z; z = z->nextslave) { data[pos++] = z->readchunk[y]; if (pos == DAHDI_CHUNKSIZE) { - if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX)) - __dahdi_receive_chunk(chan, data); + __dahdi_receive_chunk(chan, data); pos = 0; } } } } else { /* Process a normal channel */ - if (!(chan->flags & DAHDI_FLAG_NOSTDTXRX)) - __dahdi_real_receive(chan); + __dahdi_real_receive(chan); } if (chan->itimer) { chan->itimer -= DAHDI_CHUNKSIZE; @@ -8916,8 +8918,8 @@ int dahdi_receive(struct dahdi_span *span) #ifdef BUFFER_DEBUG chan->statcount -= DAHDI_CHUNKSIZE; #endif - spin_unlock(&chan->lock); } + spin_unlock(&chan->lock); } local_irq_restore(flags); -- cgit v1.2.3