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@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9599 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell
2011-01-03 18:27:31 +00:00
parent 800c356cf3
commit c380e4d91e

View File

@@ -4284,6 +4284,7 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
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 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
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 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
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);
}