[svn-commits] sruffell: branch linux/sruffell/wctdm24xxp-cmdlist r9858 - /linux/team/sruffe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 16 16:40:42 CDT 2011


Author: sruffell
Date: Wed Mar 16 16:40:38 2011
New Revision: 9858

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9858
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/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h

Modified: linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=9858&r1=9857&r2=9858
==============================================================================
--- linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c Wed Mar 16 16:40:38 2011
@@ -3852,7 +3852,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;
 
@@ -3862,10 +3864,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;
@@ -3895,7 +3897,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;
@@ -3915,11 +3919,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" : "",
@@ -3960,7 +3965,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->mods[chanoffset + x].chan = c;
@@ -4792,6 +4797,7 @@
 #endif
 {
 	struct wctdm *wc;
+	unsigned int pos;
 	int i, ret;
 
 	int anamods, digimods, curchan, curspan;
@@ -4804,9 +4810,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;
 		}
 	}
@@ -4822,7 +4828,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;
@@ -4868,7 +4874,6 @@
 	voicebus_lock_latency(&wc->vb);
 
 	wc->mods_per_board = NUM_MODULES;
-	wc->pos = i;
 	wc->txident = 1;
 
 	if (alawoverride) {
@@ -4950,7 +4955,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;
@@ -4990,7 +4997,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/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=9858&r1=9857&r2=9858
==============================================================================
--- linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Wed Mar 16 16:40:38 2011
@@ -235,7 +235,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