summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp/base.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-09-27 22:08:31 +0000
committerShaun Ruffell <sruffell@digium.com>2011-09-27 22:08:31 +0000
commit07f1c2719d9d929d3da82481c9c5c2085fa6cde9 (patch)
tree5427c496167b0609937b7fefe498ec3b89a93a89 /drivers/dahdi/wctdm24xxp/base.c
parent2caec7fc8b11cfa95b38e5a31e41947a08cc50a3 (diff)
wctdm24xxp: Set dahdi_span.devicetype string in one place.
Currently, the devicetype string was set both when the device was first allocated and updated when an echocanceler was detected. For simplicity, combine both these steps into a single function. This change also replaces an improper use of strncat with strlcat. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10210 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp/base.c')
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index e8be13c..8fac337 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -4483,7 +4483,6 @@ wctdm_init_span(struct wctdm *wc, int spanno, int chanoffset, int chancount,
(wc->desc->flags & FLAG_EXPRESS) ? " Express" : "",
pdev->bus->number, PCI_SLOT(pdev->devfn) + 1);
s->span.manufacturer = "Digium";
- strncpy(s->span.devicetype, wc->desc->name, sizeof(s->span.devicetype) - 1);
if (wc->companding == DAHDI_LAW_DEFAULT) {
if (wc->digi_mods || digital_span)
@@ -4589,15 +4588,6 @@ static void wctdm_fixup_analog_span(struct wctdm *wc, int spanno)
s->chans[y++]->sigcap = 0;
}
}
-
- for (x = 0; x < MAX_SPANS; x++) {
- if (!wc->spans[x])
- continue;
- if (wc->vpmadt032)
- strncat(wc->spans[x]->span.devicetype, " (VPMADT032)", sizeof(wc->spans[x]->span.devicetype) - 1);
- else if (wc->vpmoct)
- strncat(wc->spans[x]->span.devicetype, " (VPMOCT032)", sizeof(wc->spans[x]->span.devicetype) - 1);
- }
}
static int wctdm_initialize_vpmadt032(struct wctdm *wc)
@@ -5571,6 +5561,27 @@ static void wctdm_allocate_irq_commands(struct wctdm *wc, unsigned int count)
spin_unlock_irqrestore(&wc->reglock, flags);
}
+static void set_span_devicetype_string(struct wctdm *wc)
+{
+ unsigned int x;
+
+ for (x = 0; x < ARRAY_SIZE(wc->spans); x++) {
+ struct dahdi_span *const s = &wc->spans[x]->span;
+ if (!s)
+ continue;
+
+ strlcpy(s->devicetype, wc->desc->name, sizeof(s->devicetype));
+
+ if (wc->vpmadt032) {
+ strlcat(s->devicetype, " (VPMADT032)",
+ sizeof(s->devicetype));
+ } else if (wc->vpmoct) {
+ strlcat(s->devicetype, " (VPMOCT032)",
+ sizeof(s->devicetype));
+ }
+ }
+}
+
#ifdef USE_ASYNC_INIT
struct async_data {
struct pci_dev *pdev;
@@ -5838,6 +5849,7 @@ __wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
wc->avchannels = curchan;
+ set_span_devicetype_string(wc);
#ifdef USE_ASYNC_INIT
async_synchronize_cookie(cookie);