diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-05-23 12:20:23 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-05-23 12:20:23 +0000 |
commit | fa1d3ba9465064f7a1551fe7369525d8b355861d (patch) | |
tree | e69ab4124842248fc84b8534dd05ebe90a091cfb /drivers/dahdi/wcte12xp/base.c | |
parent | 45a4b3459991f23fc17240886d1435d67ff2e89c (diff) |
convert span->spantype to enumerated type
* This is a minimal convertion -- everything compiles and looks OK.
* We print a warning for spans registering without a spantype.
* Low-level drivers may later want (but not required)
to fold their internal representations to this canonical
representation -- it will save code and make it more readable.
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@10683 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcte12xp/base.c')
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index bef22cb..2cd7d0b 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1848,13 +1848,13 @@ static int t1_software_init(struct t1 *wc, enum linemode type) if (type == E1) { wc->span.channels = 31; - wc->span.spantype = "E1"; + wc->span.spantype = SPANTYPE_DIGITAL_E1; wc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_HDB3 | DAHDI_CONFIG_CCS | DAHDI_CONFIG_CRC4; wc->span.deflaw = DAHDI_LAW_ALAW; } else { wc->span.channels = 24; - wc->span.spantype = "T1"; + wc->span.spantype = SPANTYPE_DIGITAL_T1; wc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF; wc->span.deflaw = DAHDI_LAW_MULAW; @@ -1900,13 +1900,13 @@ error_exit: * DAHDI). * */ -static int t1xxp_set_linemode(struct dahdi_span *span, const char *linemode) +static int t1xxp_set_linemode(struct dahdi_span *span, enum spantypes linemode) { int res; struct t1 *wc = container_of(span, struct t1, span); /* We may already be set to the requested type. */ - if (!strcasecmp(span->spantype, linemode)) + if (span->spantype == linemode) return 0; res = t1_wait_for_ready(wc); @@ -1920,17 +1920,20 @@ static int t1xxp_set_linemode(struct dahdi_span *span, const char *linemode) del_timer_sync(&wc->timer); flush_workqueue(wc->wq); - if (!strcasecmp(linemode, "t1")) { + switch (linemode) { + case SPANTYPE_DIGITAL_T1: dev_info(&wc->vb.pdev->dev, "Changing from E1 to T1 line mode.\n"); res = t1_software_init(wc, T1); - } else if (!strcasecmp(linemode, "e1")) { + break; + case SPANTYPE_DIGITAL_E1: dev_info(&wc->vb.pdev->dev, "Changing from T1 to E1 line mode.\n"); res = t1_software_init(wc, E1); - } else { + break; + default: dev_err(&wc->vb.pdev->dev, - "'%s' is an unknown linemode.\n", linemode); + "Got invalid linemode %d from dahdi\n", linemode); res = -EINVAL; } |