[dahdi-commits] sruffell: linux/trunk r9606 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Jan 3 18:28:06 UTC 2011
Author: sruffell
Date: Mon Jan 3 12:28:02 2011
New Revision: 9606
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9606
Log:
dahdi: Group all conditions for skipping channel receive together.
Streamlines the function a bit by grouping the three conditions that
would cause the channel receive to be completely skipped.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9606&r1=9605&r2=9606
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan 3 12:28:02 2011
@@ -8659,9 +8659,8 @@
spin_lock(&chan->lock);
data = __buf_peek(&chan->confin);
__dahdi_receive_chunk(chan, data);
- if (data) {
- __buf_pull(&chan->confin, NULL, chans[x]);
- }
+ if (data)
+ __buf_pull(&chan->confin, NULL, chan);
spin_unlock(&chan->lock);
}
}
@@ -8848,6 +8847,13 @@
}
}
+static inline bool should_skip_receive(const struct dahdi_chan *const chan)
+{
+ return (unlikely(chan->flags & DAHDI_FLAG_NOSTDTXRX) ||
+ (chan->master != chan) ||
+ is_chan_dacsed(chan));
+}
+
int dahdi_receive(struct dahdi_span *span)
{
unsigned long flags;
@@ -8861,65 +8867,60 @@
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)) {
+ if (should_skip_receive(chan)) {
spin_unlock(&chan->lock);
continue;
}
- if (chan->master == chan) {
- if (is_chan_dacsed(chan)) {
- /* this channel is in DACS mode, there is nothing to do here */
- spin_unlock_irqrestore(&chan->lock, flags);
- continue;
- } else if (chan->nextslave) {
- __receive_from_slaves(chan);
- } else {
- /* Process a normal channel */
- __dahdi_real_receive(chan);
+
+ if (chan->nextslave) {
+ __receive_from_slaves(chan);
+ } else {
+ /* Process a normal channel */
+ __dahdi_real_receive(chan);
+ }
+ if (chan->itimer) {
+ chan->itimer -= DAHDI_CHUNKSIZE;
+ if (chan->itimer <= 0)
+ rbs_itimer_expire(chan);
+ }
+ if (chan->ringdebtimer)
+ chan->ringdebtimer--;
+ if (chan->sig & __DAHDI_SIG_FXS) {
+ if (chan->rxhooksig == DAHDI_RXSIG_RING)
+ chan->ringtrailer = DAHDI_RINGTRAILER;
+ else if (chan->ringtrailer) {
+ chan->ringtrailer -= DAHDI_CHUNKSIZE;
+ /* See if RING trailer is expired */
+ if (!chan->ringtrailer && !chan->ringdebtimer)
+ __qevent(chan, DAHDI_EVENT_RINGOFFHOOK);
}
- if (chan->itimer) {
- chan->itimer -= DAHDI_CHUNKSIZE;
- if (chan->itimer <= 0)
- rbs_itimer_expire(chan);
- }
- if (chan->ringdebtimer)
- chan->ringdebtimer--;
- if (chan->sig & __DAHDI_SIG_FXS) {
- if (chan->rxhooksig == DAHDI_RXSIG_RING)
- chan->ringtrailer = DAHDI_RINGTRAILER;
- else if (chan->ringtrailer) {
- chan->ringtrailer -= DAHDI_CHUNKSIZE;
- /* See if RING trailer is expired */
- if (!chan->ringtrailer && !chan->ringdebtimer)
- __qevent(chan, DAHDI_EVENT_RINGOFFHOOK);
+ }
+ if (chan->pulsetimer) {
+ chan->pulsetimer--;
+ if (chan->pulsetimer <= 0) {
+ if (chan->pulsecount) {
+ if (chan->pulsecount > 12) {
+
+ module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
+ chan->pulsecount,
+ chan->name);
+ } else if (chan->pulsecount > 11) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '#');
+ } else if (chan->pulsecount > 10) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '*');
+ } else if (chan->pulsecount > 9) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '0');
+ } else {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | ('0' +
+ chan->pulsecount));
+ }
+ chan->pulsecount = 0;
}
}
- if (chan->pulsetimer) {
- chan->pulsetimer--;
- if (chan->pulsetimer <= 0) {
- if (chan->pulsecount) {
- if (chan->pulsecount > 12) {
-
- module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
- chan->pulsecount,
- chan->name);
- } else if (chan->pulsecount > 11) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '#');
- } else if (chan->pulsecount > 10) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '*');
- } else if (chan->pulsecount > 9) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '0');
- } else {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | ('0' +
- chan->pulsecount));
- }
- chan->pulsecount = 0;
- }
- }
- }
+ }
#ifdef BUFFER_DEBUG
- chan->statcount -= DAHDI_CHUNKSIZE;
-#endif
- }
+ chan->statcount -= DAHDI_CHUNKSIZE;
+#endif
spin_unlock(&chan->lock);
}
More information about the dahdi-commits
mailing list