[svn-commits] sruffell: branch linux/sruffell/chan_list_refactoring r9267 - /linux/team/sru...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 2 12:41:10 CDT 2010


Author: sruffell
Date: Thu Sep  2 12:40:58 2010
New Revision: 9267

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9267
Log:
dahdi: Use 'chan' convenience pointer in process_masterspan.

Reduces the amount of indexing into the global channel array.

Modified:
    linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c

Modified: linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c?view=diff&rev=9267&r1=9266&r2=9267
==============================================================================
--- linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c Thu Sep  2 12:40:58 2010
@@ -8519,6 +8519,7 @@
 {
 	unsigned long flags;
 	int x, y, z;
+	struct dahdi_chan *chan;
 
 #ifdef CONFIG_DAHDI_CORE_TIMER
 	/* We increment the calls since start here, so that if we switch over
@@ -8539,27 +8540,29 @@
 		dahdi_dynamic_ioctl(0, 0);
 
 	for (x = 1; x < maxchans; x++) {
-		if (chans[x] && chans[x]->confmode &&
-		    !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
+		chan = chans[x];
+		if (chan && chan->confmode &&
+		    !(chan->flags & DAHDI_FLAG_PSEUDO)) {
 			u_char *data;
-			spin_lock(&chans[x]->lock);
-			data = __buf_peek(&chans[x]->confin);
-			__dahdi_receive_chunk(chans[x], data);
+			spin_lock(&chan->lock);
+			data = __buf_peek(&chan->confin);
+			__dahdi_receive_chunk(chan, data);
 			if (data) {
-				__buf_pull(&chans[x]->confin, NULL, chans[x],
+				__buf_pull(&chan->confin, NULL, chan,
 					   "confreceive");
 			}
-			spin_unlock(&chans[x]->lock);
+			spin_unlock(&chan->lock);
 		}
 	}
 	/* This is the master channel, so make things switch over */
 	rotate_sums();
 	/* do all the pseudo and/or conferenced channel receives (getbuf's) */
 	for (x = 1; x < maxchans; x++) {
-		if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
-			spin_lock(&chans[x]->lock);
-			__dahdi_transmit_chunk(chans[x], NULL);
-			spin_unlock(&chans[x]->lock);
+		chan = chans[x];
+		if (chan && (chan->flags & DAHDI_FLAG_PSEUDO)) {
+			spin_lock(&chan->lock);
+			__dahdi_transmit_chunk(chan, NULL);
+			spin_unlock(&chan->lock);
 		}
 	}
 	if (maxlinks) {
@@ -8582,25 +8585,27 @@
 	}
 	/* do all the pseudo/conferenced channel transmits (putbuf's) */
 	for (x = 1; x < maxchans; x++) {
-		if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
+		chan = chans[x];
+		if (chan && (chan->flags & DAHDI_FLAG_PSEUDO)) {
 			unsigned char tmp[DAHDI_CHUNKSIZE];
-			spin_lock(&chans[x]->lock);
-			__dahdi_getempty(chans[x], tmp);
-			__dahdi_receive_chunk(chans[x], tmp);
-			spin_unlock(&chans[x]->lock);
+			spin_lock(&chan->lock);
+			__dahdi_getempty(chan, tmp);
+			__dahdi_receive_chunk(chan, tmp);
+			spin_unlock(&chan->lock);
 		}
 	}
 	for (x = 1; x < maxchans; x++) {
-		if (chans[x] && chans[x]->confmode &&
-		    !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
+		chan = chans[x];
+		if (chan && chan->confmode &&
+		    !(chan->flags & DAHDI_FLAG_PSEUDO)) {
 			u_char *data;
-			spin_lock(&chans[x]->lock);
-			data = __buf_pushpeek(&chans[x]->confout);
-			__dahdi_transmit_chunk(chans[x], data);
+			spin_lock(&chan->lock);
+			data = __buf_pushpeek(&chan->confout);
+			__dahdi_transmit_chunk(chan, data);
 			if (data)
-				__buf_push(&chans[x]->confout, NULL,
+				__buf_push(&chan->confout, NULL,
 					   "conftransmit");
-			spin_unlock(&chans[x]->lock);
+			spin_unlock(&chan->lock);
 		}
 	}
 #ifdef	DAHDI_SYNC_TICK




More information about the svn-commits mailing list