summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRussell Bryant <russell@digium.com>2008-08-04 00:27:47 +0000
committerRussell Bryant <russell@digium.com>2008-08-04 00:27:47 +0000
commitcfeb46a159325c1e3dacd2e52d656cab08b1a8b0 (patch)
treeb1f9696edcc3ca5312988e3487f407fbcabd0492 /drivers
parentad007219e5b1c186d9804da4c177ecfdd936f7a3 (diff)
Tweak spacing and reduce indentation
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4692 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dahdi/dahdi-base.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 245e1ad..02fd6f9 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -1435,41 +1435,44 @@ static void dahdi_set_law(struct dahdi_chan *chan, int law)
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];
}