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

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


Author: sruffell
Date: Thu Sep  2 12:41:21 2010
New Revision: 9286

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9286
Log:
dahdi: Reduce 'chans' references in dahdi_ctl_ioctl.

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=9286&r1=9285&r2=9286
==============================================================================
--- 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:41:21 2010
@@ -4494,7 +4494,9 @@
 	unsigned long flags;
 	int rv;
 	struct dahdi_span *s;
-	switch(cmd) {
+	struct dahdi_chan *chan;
+
+	switch (cmd) {
 	case DAHDI_SPANCONFIG:
 	{
 		struct dahdi_lineconfig lc;
@@ -4572,6 +4574,7 @@
 			return -EFAULT;
 
 		VALID_CHANNEL(ae.chan);
+		chan = chans[ae.chan];
 
 		ae.echocan[sizeof(ae.echocan) - 1] = 0;
 		if (ae.echocan[0]) {
@@ -4580,10 +4583,10 @@
 			}
 		}
 
-		spin_lock_irqsave(&chans[ae.chan]->lock, flags);
-		old = chans[ae.chan]->ec_factory;
-		chans[ae.chan]->ec_factory = new;
-		spin_unlock_irqrestore(&chans[ae.chan]->lock, flags);
+		spin_lock_irqsave(&chan->lock, flags);
+		old = chan->ec_factory;
+		chan->ec_factory = new;
+		spin_unlock_irqrestore(&chan->lock, flags);
 
 		if (old) {
 			release_echocan(old);
@@ -4601,28 +4604,29 @@
 		if (copy_from_user(&sf, (void __user *)data, sizeof(sf)))
 			return -EFAULT;
 		VALID_CHANNEL(sf.chan);
-		if (chans[sf.chan]->sig != DAHDI_SIG_SF) return -EINVAL;
-		spin_lock_irqsave(&chans[sf.chan]->lock, flags);
-		chans[sf.chan]->rxp1 = sf.rxp1;
-		chans[sf.chan]->rxp2 = sf.rxp2;
-		chans[sf.chan]->rxp3 = sf.rxp3;
-		chans[sf.chan]->txtone = sf.txtone;
-		chans[sf.chan]->tx_v2 = sf.tx_v2;
-		chans[sf.chan]->tx_v3 = sf.tx_v3;
-		chans[sf.chan]->toneflags = sf.toneflag;
+		chan = chans[sf.chan];
+		if (chan->sig != DAHDI_SIG_SF) return -EINVAL;
+		spin_lock_irqsave(&chan->lock, flags);
+		chan->rxp1 = sf.rxp1;
+		chan->rxp2 = sf.rxp2;
+		chan->rxp3 = sf.rxp3;
+		chan->txtone = sf.txtone;
+		chan->tx_v2 = sf.tx_v2;
+		chan->tx_v3 = sf.tx_v3;
+		chan->toneflags = sf.toneflag;
 		if (sf.txtone) /* if set to make tone for tx */
 		{
-			if ((chans[sf.chan]->txhooksig && !(sf.toneflag & DAHDI_REVERSE_TXTONE)) ||
-			 ((!chans[sf.chan]->txhooksig) && (sf.toneflag & DAHDI_REVERSE_TXTONE)))
+			if ((chan->txhooksig && !(sf.toneflag & DAHDI_REVERSE_TXTONE)) ||
+			 ((!chan->txhooksig) && (sf.toneflag & DAHDI_REVERSE_TXTONE)))
 			{
-				set_txtone(chans[sf.chan],sf.txtone,sf.tx_v2,sf.tx_v3);
+				set_txtone(chan,sf.txtone,sf.tx_v2,sf.tx_v3);
 			}
 			else
 			{
-				set_txtone(chans[sf.chan],0,0,0);
+				set_txtone(chan,0,0,0);
 			}
 		}
-		spin_unlock_irqrestore(&chans[sf.chan]->lock, flags);
+		spin_unlock_irqrestore(&chan->lock, flags);
 		return res;
 	}
 	case DAHDI_DEFAULTZONE:




More information about the svn-commits mailing list