[svn-commits] sruffell: linux/trunk r9964 - /linux/trunk/drivers/dahdi/wctdm24xxp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 2 15:03:33 CDT 2011


Author: sruffell
Date: Thu Jun  2 15:03:29 2011
New Revision: 9964

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9964
Log:
wctdm24xxp: Remove 'pos' member from 'struct wctdm'.

The card position is only used during startup so we don't need to carry it
around in the strucuture.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h

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=9964&r1=9963&r2=9964
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Thu Jun  2 15:03:29 2011
@@ -3910,7 +3910,9 @@
 	return (s->linecompat > 0);
 }
 
-static struct wctdm_chan *wctdm_init_chan(struct wctdm *wc, struct wctdm_span *s, int chanoffset, int channo)
+static struct wctdm_chan *
+wctdm_init_chan(struct wctdm *wc, struct wctdm_span *s, int chanoffset,
+		int channo, unsigned int card_position)
 {
 	struct wctdm_chan *c;
 
@@ -3920,10 +3922,10 @@
 
 	/* Do not change the procfs representation for non-hx8 cards. */
 	if (dahdi_is_digital_span(&s->span)) {
-		sprintf(c->chan.name, "WCBRI/%d/%d/%d", wc->pos, s->spanno,
-			channo);
+		sprintf(c->chan.name, "WCBRI/%d/%d/%d", card_position,
+			s->spanno, channo);
 	} else {
-		sprintf(c->chan.name, "WCTDM/%d/%d", wc->pos, channo);
+		sprintf(c->chan.name, "WCTDM/%d/%d", card_position, channo);
 	}
 
 	c->chan.chanpos = channo+1;
@@ -3953,7 +3955,9 @@
 }
 #endif
 
-static struct wctdm_span *wctdm_init_span(struct wctdm *wc, int spanno, int chanoffset, int chancount, int digital_span)
+static struct wctdm_span *
+wctdm_init_span(struct wctdm *wc, int spanno, int chanoffset, int chancount,
+		int digital_span, unsigned int card_position)
 {
 	int x;
 	struct pci_dev *pdev = wc->vb.pdev;
@@ -3973,11 +3977,12 @@
 
 	/* Do not change the procfs representation for non-hx8 cards. */
 	if (digital_span)
-		sprintf(s->span.name, "WCBRI/%d/%d", wc->pos, s->spanno);
+		sprintf(s->span.name, "WCBRI/%d/%d", card_position, s->spanno);
 	else
-		sprintf(s->span.name, "WCTDM/%d", wc->pos);
-
-	snprintf(s->span.desc, sizeof(s->span.desc) - 1, "%s Board %d", wc->desc->name, wc->pos + 1);
+		sprintf(s->span.name, "WCTDM/%d", card_position);
+
+	snprintf(s->span.desc, sizeof(s->span.desc) - 1, "%s Board %d",
+		 wc->desc->name, card_position + 1);
 	snprintf(s->span.location, sizeof(s->span.location) - 1,
 		 "PCI%s Bus %02d Slot %02d",
 		 (wc->desc->flags & FLAG_EXPRESS) ? " Express" : "",
@@ -4018,7 +4023,7 @@
 
 	/* allocate channels for the span */
 	for (x = 0; x < chancount; x++) {
-		c = wctdm_init_chan(wc, s, chanoffset, x);
+		c = wctdm_init_chan(wc, s, chanoffset, x, card_position);
 		if (!c)
 			return NULL;
 		wc->chans[chanoffset + x] = c;
@@ -4852,6 +4857,7 @@
 #endif
 {
 	struct wctdm *wc;
+	unsigned int pos;
 	int i, ret;
 
 	int anamods, digimods, curchan, curspan;
@@ -4864,9 +4870,9 @@
 
 	down(&ifacelock);
 	/* \todo this is a candidate for removal... */
-	for (i = 0; i < WC_MAX_IFACES; ++i) {
-		if (!ifaces[i]) {
-			ifaces[i] = wc;
+	for (pos = 0; pos < WC_MAX_IFACES; ++pos) {
+		if (!ifaces[pos]) {
+			ifaces[pos] = wc;
 			break;
 		}
 	}
@@ -4882,7 +4888,7 @@
 	spin_lock_init(&wc->reglock);
 	wc->oldsync = -1;
 
-	wc->board_name = kasprintf(GFP_KERNEL, "%s%d", wctdm_driver.name, i);
+	wc->board_name = kasprintf(GFP_KERNEL, "%s%d", wctdm_driver.name, pos);
 	if (!wc->board_name) {
 		wctdm_back_out_gracefully(wc);
 		return -ENOMEM;
@@ -4928,7 +4934,6 @@
 	voicebus_lock_latency(&wc->vb);
 
 	wc->mods_per_board = NUM_MODULES;
-	wc->pos = i;
 	wc->txident = 1;
 
 	if (alawoverride) {
@@ -5010,7 +5015,9 @@
 				wctdm_back_out_gracefully(wc);
 				return -EIO;
 			}
-			wc->spans[curspan] = wctdm_init_span(wc, curspan, curchan, 3, 1);
+			wc->spans[curspan] = wctdm_init_span(wc, curspan,
+							     curchan, 3, 1,
+							     pos);
 			if (!wc->spans[curspan]) {
 				wctdm_back_out_gracefully(wc);
 				return -EIO;
@@ -5050,7 +5057,7 @@
 		if (!digimods) {
 			curspan = 0;
 		}
-		wctdm_init_span(wc, curspan, curchan, wc->desc->ports, 0);
+		wctdm_init_span(wc, curspan, curchan, wc->desc->ports, 0, pos);
 		wctdm_fixup_analog_span(wc, curspan);
 		wc->aspan = wc->spans[curspan];
 		curchan += wc->desc->ports;

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=9964&r1=9963&r2=9964
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Thu Jun  2 15:03:29 2011
@@ -234,7 +234,6 @@
 struct wctdm {
 	const struct wctdm_desc *desc;
 	const char *board_name;
-	int pos;				/* card number in system */
 
 	spinlock_t frame_list_lock;
 	struct list_head frame_list;




More information about the svn-commits mailing list