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

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


Author: sruffell
Date: Thu Sep  2 12:41:03 2010
New Revision: 9271

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9271
Log:
dahdi: Modify "is_monitor_mode" to be usable by dahdi_chan_unreg.

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=9271&r1=9270&r2=9271
==============================================================================
--- 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:03 2010
@@ -2013,6 +2013,26 @@
 
 #endif
 
+/**
+ * is_monitor_mode() - True if the confmode indicates that one channel is monitoring another.
+ *
+ */
+static bool is_monitor_mode(int confmode)
+{
+	confmode &= DAHDI_CONF_MODE_MASK;
+	if ((confmode == DAHDI_CONF_MONITOR) ||
+	    (confmode == DAHDI_CONF_MONITORTX) ||
+	    (confmode == DAHDI_CONF_MONITORBOTH) ||
+	    (confmode == DAHDI_CONF_MONITOR_RX_PREECHO) ||
+	    (confmode == DAHDI_CONF_MONITOR_TX_PREECHO) ||
+	    (confmode == DAHDI_CONF_MONITORBOTH_PREECHO)) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+
 static void dahdi_chan_unreg(struct dahdi_chan *chan)
 {
 	int x;
@@ -2059,13 +2079,8 @@
 				chans[x]->master = chans[x];
 			}
 			if ((chans[x]->confna == chan->channo) &&
-				((chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITOR ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITORTX ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITORBOTH ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITOR_RX_PREECHO ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITOR_TX_PREECHO ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_MONITORBOTH_PREECHO ||
-				(chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_DIGITALMON)) {
+			    is_monitor_mode(chans[x]->confmode) &&
+			    ((chans[x]->confmode & DAHDI_CONF_MODE_MASK) == DAHDI_CONF_DIGITALMON)) {
 				/* Take them out of conference with us */
 				/* release conference resource if any */
 				if (chans[x]->confna) {
@@ -4826,25 +4841,6 @@
 	return rv;
 }
 
-/**
- * is_monitor_mode() - true if dahdi_confinfo is putting chan in monitor mode
- *
- */
-static bool is_monitor_mode(const struct dahdi_confinfo *conf)
-{
-	const int confmode = conf->confmode & DAHDI_CONF_MODE_MASK;
-	if ((confmode == DAHDI_CONF_MONITOR) ||
-	    (confmode == DAHDI_CONF_MONITORTX) ||
-	    (confmode == DAHDI_CONF_MONITORBOTH) ||
-	    (confmode == DAHDI_CONF_MONITOR_RX_PREECHO) ||
-	    (confmode == DAHDI_CONF_MONITOR_TX_PREECHO) ||
-	    (confmode == DAHDI_CONF_MONITORBOTH_PREECHO)) {
-		return true;
-	} else {
-		return false;
-	}
-}
-
 static int dahdi_ioctl_setconf(struct file *file, unsigned long data)
 {
 	struct dahdi_confinfo conf;
@@ -4873,7 +4869,7 @@
 	if (!(chan->flags & DAHDI_FLAG_AUDIO))
 		return -EINVAL;
 
-	if (is_monitor_mode(&conf)) {
+	if (is_monitor_mode(conf.confmode)) {
 		/* Monitor mode -- it's a channel */
 		if ((conf.confno < 0) || (conf.confno >= DAHDI_MAX_CHANNELS) ||
 		    !chans[conf.confno])




More information about the svn-commits mailing list