dahdi: Do not allow 'hwec' to be attached to channels that do not have one.

This defines a NULL value for the name of an echocan as invalid. This
will allow dahdi_genconf to probe for the presence of a hardware echocan
on a channel by trying to attach one. If there is not a hardware echocan
available DAHDI_ATTACH_ECHOCAN ioctl will return -EINVAL if 'hwec' was
specified as the name of the echo canceler now.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9943 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-06-02 20:01:49 +00:00
parent 93a7adfb9f
commit 759f0c07f0
4 changed files with 8 additions and 6 deletions

View File

@ -4904,6 +4904,11 @@ static int dahdi_ioctl_attach_echocan(unsigned long data)
new = find_echocan(ae.echocan); new = find_echocan(ae.echocan);
if (!new) if (!new)
return -EINVAL; return -EINVAL;
if (!new->get_name(chan)) {
release_echocan(new);
return -EINVAL;
}
} }
spin_lock_irqsave(&chan->lock, flags); spin_lock_irqsave(&chan->lock, flags);

View File

@ -246,7 +246,6 @@ static int altab[] = {
static const char *vpm400_name = "VPM400M"; static const char *vpm400_name = "VPM400M";
static const char *vpmoct064_name = "VPMOCT064"; static const char *vpmoct064_name = "VPMOCT064";
static const char *vpmoct128_name = "VPMOCT128"; static const char *vpmoct128_name = "VPMOCT128";
static const char *noec_name = "NONE";
#define PORTS_PER_FRAMER 4 #define PORTS_PER_FRAMER 4
@ -1296,7 +1295,7 @@ static const char *t4_echocan_name(const struct dahdi_chan *chan)
else if (wc->numspans == 4) else if (wc->numspans == 4)
return vpmoct128_name; return vpmoct128_name;
} }
return noec_name; return NULL;
} }
static int t4_echocan_create(struct dahdi_chan *chan, static int t4_echocan_create(struct dahdi_chan *chan,

View File

@ -162,7 +162,6 @@ static alpha indirect_regs[] =
/* names of HWEC modules */ /* names of HWEC modules */
static const char *vpmadt032_name = "VPMADT032"; static const char *vpmadt032_name = "VPMADT032";
static const char *noec_name = "NONE";
/* Undefine to enable Power alarm / Transistor debug -- note: do not /* Undefine to enable Power alarm / Transistor debug -- note: do not
enable for normal operation! */ enable for normal operation! */
@ -1872,7 +1871,7 @@ static const char *wctdm_echocan_name(const struct dahdi_chan *chan)
struct wctdm *wc = chan->pvt; struct wctdm *wc = chan->pvt;
if (wc->vpmadt032) if (wc->vpmadt032)
return vpmadt032_name; return vpmadt032_name;
return noec_name; return NULL;
} }
static int wctdm_echocan_create(struct dahdi_chan *chan, static int wctdm_echocan_create(struct dahdi_chan *chan,

View File

@ -96,7 +96,6 @@ static const struct t1_desc te121 = {"Wildcard TE121"};
/* names of HWEC modules */ /* names of HWEC modules */
static const char *vpmadt032_name = "VPMADT032"; static const char *vpmadt032_name = "VPMADT032";
static const char *noec_name = "NONE";
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static kmem_cache_t *cmd_cache; static kmem_cache_t *cmd_cache;
@ -1291,7 +1290,7 @@ static const char *t1xxp_echocan_name(const struct dahdi_chan *chan)
struct t1 *wc = chan->pvt; struct t1 *wc = chan->pvt;
if (wc->vpmadt032) if (wc->vpmadt032)
return vpmadt032_name; return vpmadt032_name;
return noec_name; return NULL;
} }
static int t1xxp_echocan_create(struct dahdi_chan *chan, static int t1xxp_echocan_create(struct dahdi_chan *chan,