[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-cmdqueue r6036 - /linux/team/sruf...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Feb 24 16:03:51 CST 2009


Author: sruffell
Date: Tue Feb 24 16:03:51 2009
New Revision: 6036

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6036
Log:
Remove the usecount and dead members from struct t1 since the module reference
count will allow us to know when it's safe to free up the memory.

Modified:
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6036&r1=6035&r2=6036
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c Tue Feb 24 16:03:51 2009
@@ -809,29 +809,15 @@
 
 static int t1xxp_open(struct dahdi_chan *chan)
 {
-	struct t1 *wc = chan->pvt;
-
-	if (wc->dead)
-		return -ENODEV;
-	wc->usecount++;
-
-	try_module_get(THIS_MODULE);
-
-	return 0;
+	if (!try_module_get(THIS_MODULE))
+		return -ENXIO;
+	else 
+		return 0;
 }
 
 static int t1xxp_close(struct dahdi_chan *chan)
 {
-	struct t1 *wc = chan->pvt;
-
-	wc->usecount--;
-
 	module_put(THIS_MODULE);
-
-	/* If we're dead, release us now */
-	if (!wc->usecount && wc->dead) 
-		t1_release(wc);
-
 	return 0;
 }
 
@@ -1216,9 +1202,8 @@
 			led = UNSET_LED_REDGREEN(led); 
 	}
 
-	if (led != wc->ledlastvalue) {
+	if (led != wc->ledtestreg) {
 		spin_lock_irqsave(&wc->reglock, flags);
-		wc->ledlastvalue = led;
 		wc->ledtestreg = led;
 		spin_unlock_irqrestore(&wc->reglock, flags);
 		t1_setleds(wc, led);
@@ -1506,11 +1491,7 @@
 		kfree(wc->vpm150m);
 	}
 #endif
-	/* Release span, possibly delayed */
-	if (!wc->usecount)
-		t1_release(wc);
-	else
-		wc->dead = 1;
+	t1_release(wc);
 }
 
 static struct pci_device_id te12xp_pci_tbl[] = {

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=6036&r1=6035&r2=6036
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h Tue Feb 24 16:03:51 2009
@@ -75,7 +75,7 @@
 #define SET_LED_GREEN(a) (a | __LED_GREEN) & ~__LED_RED
 
 #define UNSET_LED_ORANGE(a) a & ~__LED_ORANGE 
-#define UNSET_LED_REDGREEN(a) (a & ~(__LED_RED | __LED_GREEN))
+#define UNSET_LED_REDGREEN(a) a | __LED_RED | __LED_GREEN
 
 #define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR)
 #define CMD_RD(a) (((a) << 8) | __CMD_RD)
@@ -123,9 +123,7 @@
 	char *variety;
 	char name[80];
 	int sync;
-	int dead;
 	unsigned long blinktimer;
-	int ledlastvalue;
 	int alarms_read;
 	int checktiming;	/* Set >0 to cause the timing source to be checked */
 	int loopupcnt;
@@ -140,7 +138,6 @@
 	struct dahdi_chan *chans[32];					/* Channels */
 	struct command dummy;	/* preallocate for dummy noop command */
 	unsigned char ctlreg;
-	int usecount;
 	struct voicebus* vb;
 	atomic_t txints;
 #ifdef VPM_SUPPORT




More information about the dahdi-commits mailing list