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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 4 11:40:57 CDT 2010


Author: sruffell
Date: Thu Nov  4 11:40:53 2010
New Revision: 9469

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9469
Log:
wctdm24xxp: Replace 'schluffen()' with 'interruptible_sleep_on()'

'schluffen()' essentially duplicates the functionality of the standard
Linux 'interruptible_sleep_on()' function.

There may still be some race conditions that can be closed here, but
most of the command queue processing is sloted for conversion to
something more like in the single span driver in order to reduce the
time in interrupt context spent scanning for commands to the modules.

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

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.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=9469&r1=9468&r2=9469
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Thu Nov  4 11:40:53 2010
@@ -296,19 +296,6 @@
 			+ ((card) >> 2) + (altcs) + ((altcs) ? -21 : 0));
 }
 
-/* sleep in user space until woken up. Equivilant of tsleep() in BSD */
-int schluffen(wait_queue_head_t *q)
-{
-	DECLARE_WAITQUEUE(wait, current);
-	add_wait_queue(q, &wait);
-	current->state = TASK_INTERRUPTIBLE;
-	if (!signal_pending(current)) schedule();
-	current->state = TASK_RUNNING;
-	remove_wait_queue(q, &wait);
-	if (signal_pending(current)) return -ERESTARTSYS;
-	return(0);
-}
-
 static inline int empty_slot(struct wctdm *wc, int card)
 {
 	int x;
@@ -1007,7 +994,6 @@
 {
 	unsigned long flags;
 	int hit=0;
-	int ret;
 
 	/* QRV and BRI cards are only addressed at their first "port" */
 	if ((card & 0x03) && ((wc->modtype[card] ==  MOD_TYPE_QRV) ||
@@ -1024,8 +1010,9 @@
 		if (inisr)
 			break;
 		if (hit < 0) {
-			if ((ret = schluffen(&wc->regq)))
-				return ret;
+			interruptible_sleep_on(&wc->regq);
+			if (signal_pending(current))
+				return -ERESTARTSYS;
 		}
 	} while (hit < 0);
 	return (hit > -1) ? 0 : -1;
@@ -1059,8 +1046,9 @@
 		}
 		spin_unlock_irqrestore(&wc->reglock, flags);
 		if (hit < 0) {
-			if ((ret = schluffen(&wc->regq)))
-				return ret;
+			interruptible_sleep_on(&wc->regq);
+			if (signal_pending(current))
+				return -ERESTARTSYS;
 		}
 	} while (hit < 0);
 	do {
@@ -1072,8 +1060,9 @@
 		}
 		spin_unlock_irqrestore(&wc->reglock, flags);
 		if (hit > -1) {
-			if ((ret = schluffen(&wc->regq)))
-				return ret;
+			interruptible_sleep_on(&wc->regq);
+			if (signal_pending(current))
+				return -ERESTARTSYS;
 		}
 	} while (hit > -1);
 	return ret;
@@ -4004,7 +3993,7 @@
 		}
 
 		for (i=0;i<30;i++) 
-			schluffen(&wc->regq);
+			interruptible_sleep_on(&wc->regq);
 
 		/* Put in bypass mode */
 		for (i = 0 ; i < MAX_TDM_CHAN ; i++) {
@@ -4240,7 +4229,7 @@
 
 /* Wait just a bit; this makes sure that cmd_dequeue is emitting SPI commands in the appropriate mode(s). */
 	for (x = 0; x < 10; x++)
-		schluffen(&wc->regq);
+		interruptible_sleep_on(&wc->regq);
 
 /* Now that all the cards have been reset, we can stop checking them all if there aren't as many */
 	spin_lock_irqsave(&wc->reglock, flags);
@@ -4306,8 +4295,8 @@
 					wc->modtype[x] = MOD_TYPE_FXSINIT;
 					spin_unlock_irqrestore(&wc->reglock, flags);
 
-					schluffen(&wc->regq);
-					schluffen(&wc->regq);
+					interruptible_sleep_on(&wc->regq);
+					interruptible_sleep_on(&wc->regq);
 
 					spin_lock_irqsave(&wc->reglock, flags);
 					wc->modtype[x] = MOD_TYPE_FXS;

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=9469&r1=9468&r2=9469
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Thu Nov  4 11:40:53 2010
@@ -204,7 +204,7 @@
 	signed short txgain[NUM_MODULES];
 
 	spinlock_t reglock;			/* held when accessing anything affecting the module array */
-	wait_queue_head_t regq;			/* for schluffen() */
+	wait_queue_head_t regq;
 
 	union {
 		struct fxo {
@@ -286,7 +286,6 @@
 /* Atomic flag bits for checkflag field */
 #define WCTDM_CHECK_TIMING	0
 
-int schluffen(wait_queue_head_t *q);
 void wait_just_a_bit(int foo);
 int wctdm_getreg(struct wctdm *wc, int card, int addr);
 int wctdm_setreg(struct wctdm *wc, int card, int addr, int val);

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c?view=diff&rev=9469&r1=9468&r2=9469
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c Thu Nov  4 11:40:53 2010
@@ -2641,7 +2641,7 @@
 		spin_unlock_irqrestore(&wc->reglock, flags);
 
 		for (i = 0; i < 10; i++)
-			schluffen(&wc->regq);
+			interruptible_sleep_on(&wc->regq);
 
 		if (b400m_probe(wc, card) != 0) {
 			spin_lock_irqsave(&wc->reglock, flags);




More information about the svn-commits mailing list