[dahdi-commits] russell: linux/trunk r4692 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Sun Aug 3 19:27:47 CDT 2008


Author: russell
Date: Sun Aug  3 19:27:47 2008
New Revision: 4692

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4692
Log:
Tweak spacing and reduce indentation

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=4692&r1=4691&r2=4692
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Sun Aug  3 19:27:47 2008
@@ -1435,41 +1435,44 @@
 static int dahdi_chan_reg(struct dahdi_chan *chan)
 {
 	int x;
-	int res=0;
+	int res = 0;
 	unsigned long flags;
 
 	write_lock_irqsave(&chan_lock, flags);
-	for (x=1;x<DAHDI_MAX_CHANNELS;x++) {
-		if (!chans[x]) {
-			spin_lock_init(&chan->lock);
-			chans[x] = chan;
-			if (maxchans < x + 1)
-				maxchans = x + 1;
-			chan->channo = x;
-			if (!chan->master)
-				chan->master = chan;
-			if (!chan->readchunk)
-				chan->readchunk = chan->sreadchunk;
-			if (!chan->writechunk)
-				chan->writechunk = chan->swritechunk;
-			dahdi_set_law(chan, 0);
-			close_channel(chan);
-			/* set this AFTER running close_channel() so that
-				HDLC channels wont cause hangage */
-			chan->flags |= DAHDI_FLAG_REGISTERED;
-			res = 0;
-			break;
-		}
+	for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
+		if (chans[x])
+			continue;
+
+		spin_lock_init(&chan->lock);
+		chans[x] = chan;
+		if (maxchans < x + 1)
+			maxchans = x + 1;
+		chan->channo = x;
+		if (!chan->master)
+			chan->master = chan;
+		if (!chan->readchunk)
+			chan->readchunk = chan->sreadchunk;
+		if (!chan->writechunk)
+			chan->writechunk = chan->swritechunk;
+		dahdi_set_law(chan, 0);
+		close_channel(chan);
+		/* set this AFTER running close_channel() so that
+		   HDLC channels wont cause hangage */
+		chan->flags |= DAHDI_FLAG_REGISTERED;
+		res = 0;
+		break;
 	}
 	write_unlock_irqrestore(&chan_lock, flags);
-	if (x >= DAHDI_MAX_CHANNELS)
+
+	if (x == DAHDI_MAX_CHANNELS)
 		module_printk(KERN_ERR, "No more channels available\n");
+
 	return res;
 }
 
 char *dahdi_lboname(int x)
 {
-	if ((x < 0) || ( x > 7))
+	if ((x < 0) || (x > 7))
 		return "Unknown";
 	return dahdi_txlevelnames[x];
 }




More information about the dahdi-commits mailing list