[svn-commits] sruffell: linux/trunk r9599 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 3 18:27:35 UTC 2011


Author: sruffell
Date: Mon Jan  3 12:27:31 2011
New Revision: 9599

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9599
Log:
dahdi: Use 'dacs_chan' convenience pointer in dahdi_ioctl_chanconfig.

Eliminates the need to look for the channel number twice.

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=9599&r1=9598&r2=9599
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan  3 12:27:31 2011
@@ -4284,6 +4284,7 @@
 	struct dahdi_chanconfig ch;
 	struct dahdi_chan *newmaster;
 	struct dahdi_chan *chan;
+	struct dahdi_chan *dacs_chan = NULL;
 	unsigned long flags;
 	int sigcap;
 
@@ -4301,7 +4302,8 @@
 		ch.sigtype = newmaster->sig;
 	} else if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) {
 		newmaster = chan;
-		if (!chan_from_num(ch.idlebits))
+		dacs_chan = chan_from_num(ch.idlebits);
+		if (!dacs_chan)
 			return -EINVAL;
 	} else {
 		newmaster = chan;
@@ -4378,10 +4380,14 @@
 			chan->flags &= ~DAHDI_FLAG_FCS;
 		}
 		if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) {
+			if (unlikely(!dacs_chan)) {
+				spin_unlock_irqrestore(&chan->lock, flags);
+				return -EINVAL;
+			}
 			/* Setup conference properly */
 			chan->confmode = DAHDI_CONF_DIGITALMON;
 			chan->confna = ch.idlebits;
-			res = dahdi_chan_dacs(chan, chan_from_num(ch.idlebits));
+			res = dahdi_chan_dacs(chan, dacs_chan);
 		} else {
 			dahdi_disable_dacs(chan);
 		}




More information about the svn-commits mailing list