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

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


Author: sruffell
Date: Thu Sep  2 12:41:22 2010
New Revision: 9287

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

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=9287&r1=9286&r2=9287
==============================================================================
--- 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:22 2010
@@ -4887,6 +4887,7 @@
 {
 	struct dahdi_confinfo conf;
 	struct dahdi_chan *chan;
+	struct dahdi_chan *conf_chan = NULL;
 	unsigned long flags;
 	unsigned int confmode;
 	int j;
@@ -4912,9 +4913,9 @@
 		return -EINVAL;
 
 	if (is_monitor_mode(conf.confmode)) {
-		/* Monitor mode -- it's a channel */
-		if ((conf.confno < 0) || (conf.confno >= DAHDI_MAX_CHANNELS) ||
-		    !chans[conf.confno])
+		VALID_CHANNEL(conf.confno);
+		conf_chan = chans[conf.confno];
+		if (!conf_chan)
 			return -EINVAL;
 	} else {
 		/* make sure conf number makes sense, too */
@@ -4955,9 +4956,9 @@
 		if ((confmode == DAHDI_CONF_DIGITALMON) &&
 		    (chan->txgain == defgain) &&
 		    (chan->rxgain == defgain) &&
-		    (chans[conf.confno]->txgain == defgain) &&
-		    (chans[conf.confno]->rxgain == defgain)) {
-			dahdi_chan_dacs(chan, chans[conf.confno]);
+		    (conf_chan->txgain == defgain) &&
+		    (conf_chan->rxgain == defgain)) {
+			dahdi_chan_dacs(chan, conf_chan);
 		} else {
 			dahdi_disable_dacs(chan);
 		}
@@ -4973,16 +4974,16 @@
 		chan->_confn = dahdi_get_conf_alias(conf.confno);
 	}
 
-	if (chans[conf.confno]) {
+	if (conf_chan) {
 		if ((confmode == DAHDI_CONF_MONITOR_RX_PREECHO) ||
 		    (confmode == DAHDI_CONF_MONITOR_TX_PREECHO) ||
 		    (confmode == DAHDI_CONF_MONITORBOTH_PREECHO)) {
 			void *temp = kmalloc(sizeof(*chan->readchunkpreec) *
 					     DAHDI_CHUNKSIZE, GFP_ATOMIC);
-			chans[conf.confno]->readchunkpreec = temp;
+			conf_chan->readchunkpreec = temp;
 		} else {
-			kfree(chans[conf.confno]->readchunkpreec);
-			chans[conf.confno]->readchunkpreec = NULL;
+			kfree(conf_chan->readchunkpreec);
+			conf_chan->readchunkpreec = NULL;
 		}
 	}
 




More information about the svn-commits mailing list