[svn-commits] sruffell: linux/trunk r10210 - /linux/trunk/drivers/dahdi/wctdm24xxp/base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Sep 27 17:08:34 CDT 2011
Author: sruffell
Date: Tue Sep 27 17:08:31 2011
New Revision: 10210
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10210
Log:
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 at digium.com>
Modified:
linux/trunk/drivers/dahdi/wctdm24xxp/base.c
Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10210&r1=10209&r2=10210
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Tue Sep 27 17:08:31 2011
@@ -4483,7 +4483,6 @@
(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)
@@ -4588,15 +4587,6 @@
} else {
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);
}
}
@@ -5571,6 +5561,27 @@
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 @@
wc->avchannels = curchan;
+ set_span_devicetype_string(wc);
#ifdef USE_ASYNC_INIT
async_synchronize_cookie(cookie);
More information about the svn-commits
mailing list