[dahdi-commits] sruffell: branch linux/sruffell/chan_list r9336 - /linux/team/sruffell/chan_l...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Sep 17 14:11:48 CDT 2010


Author: sruffell
Date: Fri Sep 17 14:11:36 2010
New Revision: 9336

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

Eliminates the need to look for the channel number twice.

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

Modified: linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c?view=diff&rev=9336&r1=9335&r2=9336
==============================================================================
--- linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c Fri Sep 17 14:11:36 2010
@@ -4277,6 +4277,7 @@
 	struct dahdi_chanconfig ch;
 	struct dahdi_chan *newmaster;
 	struct dahdi_chan *chan;
+	struct dahdi_chan *dacs_chan = NULL;
 	unsigned long flags;
 	int sigcap;
 
@@ -4294,7 +4295,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;
@@ -4371,10 +4373,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 dahdi-commits mailing list