[svn-commits] sruffell: linux/trunk r10242 - /linux/trunk/drivers/dahdi/wct4xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 20 15:52:55 CDT 2011


Author: sruffell
Date: Thu Oct 20 15:52:52 2011
New Revision: 10242

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10242
Log:
wct4xxp: Remove redundant 'vpm' from struct t4.

Since removal of the VPM400 support the 'vpm' member of struct t4 is
now redundant with the 'vpm450m' member.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Michael Spiceland <mspiceland at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/base.c

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=10242&r1=10241&r2=10242
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Thu Oct 20 15:52:52 2011
@@ -238,6 +238,7 @@
 
 /* names of available HWEC modules */
 #ifdef VPM_SUPPORT
+#define T4_VPM_PRESENT (1 << 28)
 static const char *vpmoct064_name = "VPMOCT064";
 static const char *vpmoct128_name = "VPMOCT128";
 #endif
@@ -369,12 +370,9 @@
 	
 #ifdef VPM_SUPPORT
 	struct vpm450m *vpm450m;
-	int vpm;
 #endif	
 
 };
-
-#define T4_VPM_PRESENT (1 << 28)
 
 #ifdef VPM_SUPPORT
 static void t4_vpm450_init(struct t4 *wc);
@@ -1014,7 +1012,7 @@
 static const char *t4_echocan_name(const struct dahdi_chan *chan)
 {
 	struct t4 *wc = chan->pvt;
-	if (wc->vpm == T4_VPM_PRESENT) {
+	if (wc->vpm450m) {
 		if (wc->numspans == 2)
 			return vpmoct064_name;
 		else if (wc->numspans == 4)
@@ -1034,7 +1032,7 @@
 	const struct dahdi_echocan_ops *ops;
 	const struct dahdi_echocan_features *features;
 
-	if (!vpmsupport || !wc->vpm)
+	if (!vpmsupport || !wc->vpm450m)
 		return -ENODEV;
 
 	ops = &vpm_ec_ops;
@@ -1112,7 +1110,7 @@
 	case DAHDI_TONEDETECT:
 		if (get_user(j, (__user int *) data))
 			return -EFAULT;
-		if (!wc->vpm)
+		if (!wc->vpm450m)
 			return -ENOSYS;
 		if (j && (vpmdtmfsupport == 0))
 			return -ENOSYS;
@@ -1124,13 +1122,13 @@
 			set_bit(chan->chanpos - 1, &ts->dtmfmutemask);
 		else
 			clear_bit(chan->chanpos - 1, &ts->dtmfmutemask);
-		if (wc->vpm450m) {
-			channel = (chan->chanpos) << 2;
-			if (!wc->t1e1)
-				channel += (4 << 2);
-			channel |= chan->span->offset;
-			vpm450m_setdtmf(wc->vpm450m, channel, j & DAHDI_TONEDETECT_ON, j & DAHDI_TONEDETECT_MUTE);
-		}
+
+		channel = (chan->chanpos) << 2;
+		if (!wc->t1e1)
+			channel += (4 << 2);
+		channel |= chan->span->offset;
+		vpm450m_setdtmf(wc->vpm450m, channel, j & DAHDI_TONEDETECT_ON,
+				j & DAHDI_TONEDETECT_MUTE);
 		return 0;
 #endif
 	default:
@@ -1691,26 +1689,33 @@
 	return 0;
 }
 
+#ifdef VPM_SUPPORT
 static void set_span_devicetype(struct t4 *wc)
 {
 	int x;
-	struct t4_span *ts;
 
 	for (x = 0; x < wc->numspans; x++) {
-		ts = wc->tspans[x];
+		struct t4_span *const ts = wc->tspans[x];
 		strlcpy(ts->span.devicetype, wc->devtype->desc,
 			sizeof(ts->span.devicetype));
-#ifdef VPM_SUPPORT
-		if (wc->vpm == T4_VPM_PRESENT) {
-			if (!wc->vpm450m)
-				strncat(ts->span.devicetype, " (VPM400M)", sizeof(ts->span.devicetype) - 1);
-			else
-				strncat(ts->span.devicetype, (wc->numspans > 2) ? " (VPMOCT128)" : " (VPMOCT064)",
-					sizeof(ts->span.devicetype) - 1);
-		}
-#endif
-	}
-}
+
+		if (wc->vpm450m) {
+			strncat(ts->span.devicetype, (wc->numspans > 2) ? " (VPMOCT128)" : " (VPMOCT064)",
+				sizeof(ts->span.devicetype) - 1);
+		}
+	}
+}
+#else
+static void set_span_devicetype(struct t4 *wc)
+{
+	int x;
+	for (x = 0; x < wc->numspans; x++) {
+		struct t4_span *const ts = wc->tspans[x];
+		strlcpy(ts->span.devicetype, wc->devtype->desc,
+			sizeof(ts->span.devicetype));
+	}
+}
+#endif
 
 /* The number of cards we have seen with each
    possible 'order' switch setting.
@@ -2404,7 +2409,7 @@
 		/* Start DMA, enabling DMA interrupts on read only */
 		wc->dmactrl |= (ts->spanflags & FLAG_2NDGEN) ? 0xc0000000 : 0xc0000003;
 #ifdef VPM_SUPPORT
-		wc->dmactrl |= wc->vpm;
+		wc->dmactrl |= (wc->vpm450m) ? T4_VPM_PRESENT : 0;
 #endif
 		/* Seed interrupt register */
 		__t4_pci_out(wc, WC_INTR, 0x0c);
@@ -3443,14 +3448,12 @@
 		}
 	}
 #ifdef VPM_SUPPORT
-	if (wc->vpm) {
+	if (wc->vpm450m) {
 		if (test_and_clear_bit(T4_CHECK_VPM, &wc->checkflag)) {
-			if (wc->vpm450m) {
-				/* How stupid is it that the octasic can't generate an
-				   interrupt when there's a tone, in spite of what their
-				   documentation says? */
-				t4_check_vpm450(wc);
-			}
+			/* How stupid is it that the octasic can't generate an
+			 * interrupt when there's a tone, in spite of what
+			 * their documentation says? */
+			t4_check_vpm450(wc);
 		}
 	}
 #endif
@@ -3616,15 +3619,12 @@
 	}
 
 #ifdef VPM_SUPPORT
-	if (wc->vpm && vpmdtmfsupport) {
-		if (wc->vpm450m) {
-			/* How stupid is it that the octasic can't generate an
-			   interrupt when there's a tone, in spite of what their
-			   documentation says? */
-			if (!(wc->intcount & 0xf)) {
-				set_bit(T4_CHECK_VPM, &wc->checkflag);
-			}
-		}
+	if (wc->vpm450m && vpmdtmfsupport) {
+		/* How stupid is it that the octasic can't generate an
+		 * interrupt when there's a tone, in spite of what their
+		 * documentation says? */
+		if (!(wc->intcount & 0xf))
+			set_bit(T4_CHECK_VPM, &wc->checkflag);
 	}
 #endif
 
@@ -3663,7 +3663,8 @@
 	t4_pci_out(wc, WC_COUNT, ((DAHDI_MAX_CHUNKSIZE * 2 * 32 - 1) << 18) | ((DAHDI_MAX_CHUNKSIZE * 2 * 32 - 1) << 2));
 	t4_pci_out(wc, WC_INTR, 0);
 #ifdef VPM_SUPPORT
-	wc->dmactrl = 0xc0000000 | (1 << 29) | wc->vpm;
+	wc->dmactrl = 0xc0000000 | (1 << 29) |
+		      ((wc->vpm450m) ? T4_VPM_PRESENT : 0);
 #else	
 	wc->dmactrl = 0xc0000000 | (1 << 29);
 #endif
@@ -3778,7 +3779,6 @@
 		vpmdtmfsupport = 0;
 	}
 
-	wc->vpm = T4_VPM_PRESENT;
 	dev_info(&wc->dev->dev, "VPM450: Present and operational servicing %d "
 			"span(s)\n", wc->numspans);
 		
@@ -4237,11 +4237,11 @@
 	t4_gpio_setdir(wc, (0xff), (0xff));
 
 #ifdef VPM_SUPPORT
-	if (!wc->vpm) {
+	if (!wc->vpm450m) {
 		t4_vpm450_init(wc);
-		wc->dmactrl |= wc->vpm;
+		wc->dmactrl |= (wc->vpm450m) ? T4_VPM_PRESENT : 0;
 		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
-		if (wc->vpm)
+		if (wc->vpm450m)
 			set_span_devicetype(wc);
 	}
 #endif




More information about the svn-commits mailing list