[svn-commits] sruffell: linux/trunk r8981 - in /linux/trunk/drivers/dahdi: voicebus/ wctdm2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Jul 25 19:30:51 CDT 2010


Author: sruffell
Date: Sun Jul 25 19:30:37 2010
New Revision: 8981

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8981
Log:
wcte12xp, wctdm24xxp: spin_lock_bh -> spin_lock_irqsave

Will add an option to allow calling the deferred processing callback directly
in the interrupt handler.  It appears there are some systems which still are
unable to process their tasklets in a timely fashion, especially if they get
pushed out to the ksoftirqd daemon.

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

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8981&r1=8980&r2=8981
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Sun Jul 25 19:30:37 2010
@@ -243,6 +243,7 @@
 int
 voicebus_set_minlatency(struct voicebus *vb, unsigned int ms)
 {
+	unsigned long flags;
 	/*
 	 * One millisecond of latency means that we have 3 buffers pending,
 	 * since two are always going to be waiting in the TX fifo on the
@@ -257,9 +258,9 @@
 		dev_warn(&vb->pdev->dev, MESSAGE, ms, VOICEBUS_DEFAULT_LATENCY);
 		return -EINVAL;
 	}
-	spin_lock_bh(&vb->lock);
+	spin_lock_irqsave(&vb->lock, flags);
 	vb->min_tx_buffer_count = ms;
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 	return 0;
 }
 EXPORT_SYMBOL(voicebus_set_minlatency);
@@ -269,9 +270,10 @@
 voicebus_current_latency(struct voicebus *vb)
 {
 	int latency;
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&vb->lock, flags);
 	latency = vb->min_tx_buffer_count;
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 	return latency;
 }
 EXPORT_SYMBOL(voicebus_current_latency);
@@ -295,10 +297,11 @@
 static inline u32
 vb_getctl(struct voicebus *vb, u32 addr)
 {
+	unsigned long flags;
 	u32 val;
-	spin_lock_bh(&vb->lock);
+	spin_lock_irqsave(&vb->lock, flags);
 	val = __vb_getctl(vb, addr);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 	return val;
 }
 
@@ -322,9 +325,10 @@
 vb_is_stopped(struct voicebus *vb)
 {
 	int ret;
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&vb->lock, flags);
 	ret = __vb_is_stopped(vb);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 	return ret;
 }
 
@@ -442,9 +446,10 @@
 static inline void
 vb_setctl(struct voicebus *vb, u32 addr, u32 val)
 {
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&vb->lock, flags);
 	__vb_setctl(vb, addr, val);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 
 static int
@@ -480,26 +485,28 @@
 {
 	u32 bits;
 	u32 sdi = 0;
+	unsigned long flags;
 	/* Send preamble */
 	bits = 0xffffffff;
-	spin_lock_bh(&vb->lock);
+	spin_lock_irqsave(&vb->lock, flags);
 	__vb_sdi_sendbits(vb, bits, 32, &sdi);
 	bits = (0x5 << 12) | (1 << 7) | (addr << 2) | 0x2;
 	__vb_sdi_sendbits(vb, bits, 16, &sdi);
 	__vb_sdi_sendbits(vb, val, 16, &sdi);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 
 static void
 vb_enable_io_access(struct voicebus *vb)
 {
 	u32 reg;
+	unsigned long flags;
 	BUG_ON(!vb->pdev);
-	spin_lock_bh(&vb->lock);
+	spin_lock_irqsave(&vb->lock, flags);
 	pci_read_config_dword(vb->pdev, 0x0004, &reg);
 	reg |= 0x00000007;
 	pci_write_config_dword(vb->pdev, 0x0004, reg);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 
 /*! \brief Resets the voicebus hardware interface. */
@@ -864,16 +871,18 @@
 static void
 vb_disable_interrupts(struct voicebus *vb)
 {
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&vb->lock, flags);
 	__vb_disable_interrupts(vb);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 
 static void start_packet_processing(struct voicebus *vb)
 {
 	u32 reg;
-
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+
+	spin_lock_irqsave(&vb->lock, flags);
 	clear_bit(VOICEBUS_STOP, &vb->flags);
 	clear_bit(VOICEBUS_STOPPED, &vb->flags);
 #if defined(CONFIG_VOICEBUS_TIMER)
@@ -891,7 +900,7 @@
 	__vb_rx_demand_poll(vb);
 	__vb_tx_demand_poll(vb);
 	__vb_getctl(vb, 0x0030);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 
 static void vb_tasklet_boot(unsigned long data);

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.h?view=diff&rev=8981&r1=8980&r2=8981
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.h Sun Jul 25 19:30:37 2010
@@ -216,10 +216,11 @@
 static inline void
 voicebus_set_maxlatency(struct voicebus *vb, unsigned int max_latency)
 {
-	spin_lock_bh(&vb->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&vb->lock, flags);
 	vb->max_latency = clamp(max_latency,
 				vb->min_tx_buffer_count,
 				VOICEBUS_DEFAULT_MAXLATENCY);
-	spin_unlock_bh(&vb->lock);
+	spin_unlock_irqrestore(&vb->lock, flags);
 }
 #endif /* __VOICEBUS_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=8981&r1=8980&r2=8981
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Sun Jul 25 19:30:37 2010
@@ -4214,9 +4214,9 @@
 	if (bootloader)
 		vbb->data[EFRAME_SIZE + 3] = 0xAA;
 
-	spin_lock_bh(&wc->vb.lock);
+	spin_lock_irqsave(&wc->vb.lock, flags);
 	voicebus_transmit(&wc->vb, vbb);
-	spin_unlock_bh(&wc->vb.lock);
+	spin_unlock_irqrestore(&wc->vb.lock, flags);
 
 	/* Do not wait for the response if the caller doesn't care about the
 	 * results. */

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8981&r1=8980&r2=8981
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Sun Jul 25 19:30:37 2010
@@ -152,10 +152,10 @@
 	list_splice_init(&wc->active_cmds, &wc->pending_cmds);
 	spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
 
-	spin_lock(&wc->reglock);
+	spin_lock_irqsave(&wc->reglock, flags);
 	if (wc->vpmadt032)
 		vpmadt032_resend(wc->vpmadt032);
-	spin_unlock(&wc->reglock);
+	spin_unlock_irqrestore(&wc->reglock, flags);
 }
 
 static void cmd_dequeue(struct t1 *wc, unsigned char *writechunk, int eframe, int slot)
@@ -572,6 +572,7 @@
 {
 	struct command *cmd =  NULL;
 	unsigned long ret;
+	unsigned long flags;
 
 	might_sleep();
 
@@ -584,12 +585,12 @@
 	submit_cmd(wc, cmd);
 	ret = wait_for_completion_timeout(&cmd->complete, HZ*10);
 	if (unlikely(!ret)) {
-		spin_lock_bh(&wc->cmd_list_lock);
+		spin_lock_irqsave(&wc->cmd_list_lock, flags);
 		if (!list_empty(&cmd->node)) {
 			/* Since we've removed this command from the list, we
 			 * can go ahead and free it right away. */
 			list_del_init(&cmd->node);
-			spin_unlock_bh(&wc->cmd_list_lock);
+			spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
 			if (printk_ratelimit()) {
 				dev_warn(&wc->vb.pdev->dev,
 					 "Timeout in %s\n", __func__);
@@ -600,7 +601,7 @@
 			/* Looks like this command was removed from the list by
 			 * someone else already. Let's wait for them to complete
 			 * it so that we don't free up the memory. */
-			spin_unlock_bh(&wc->cmd_list_lock);
+			spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
 			ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
 			WARN_ON(!ret);
 			ret = cmd->data;
@@ -630,6 +631,7 @@
 static inline int t1_getpins(struct t1 *wc, int inisr)
 {
 	struct command *cmd;
+	unsigned long flags;
 	unsigned long ret;
 
 	cmd = get_free_cmd(wc);
@@ -641,9 +643,9 @@
 	submit_cmd(wc, cmd);
 	ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
 	if (unlikely(!ret)) {
-		spin_lock_bh(&wc->cmd_list_lock);
+		spin_lock_irqsave(&wc->cmd_list_lock, flags);
 		list_del_init(&cmd->node);
-		spin_unlock_bh(&wc->cmd_list_lock);
+		spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
 		if (printk_ratelimit()) {
 			dev_warn(&wc->vb.pdev->dev,
 				 "Timeout in %s\n", __func__);
@@ -1407,6 +1409,7 @@
 static int check_and_load_vpm(struct t1 *wc)
 {
 	int res;
+	unsigned long flags;
 	struct vpmadt032_options options;
 
 	if (!vpmsupport) {
@@ -1445,9 +1448,9 @@
 	if (-ENODEV == res) {
 		/* There does not appear to be a VPMADT032 installed. */
 		clear_bit(4, &wc->ctlreg);
-		spin_lock_bh(&wc->reglock);
+		spin_lock_irqsave(&wc->reglock, flags);
 		wc->vpmadt032 = NULL;
-		spin_unlock_bh(&wc->reglock);
+		spin_unlock_irqrestore(&wc->reglock, flags);
 		vpmadt032_free(wc->vpmadt032);
 		return res;
 
@@ -1856,6 +1859,7 @@
 	int x;
 	int y;
 	int chan;
+	unsigned long flags;
 
 	/* Calculate Transmission */
 	if (likely(test_bit(INITIALIZED, &wc->bit_flags))) {
@@ -1873,10 +1877,10 @@
 			cmd_dequeue(wc, writechunk, x, y);
 
 #ifdef VPM_SUPPORT
-		spin_lock(&wc->reglock);
+		spin_lock_irqsave(&wc->reglock, flags);
 		if (wc->vpmadt032)
 			cmd_dequeue_vpmadt032(wc, writechunk, x);
-		spin_unlock(&wc->reglock);
+		spin_unlock_irqrestore(&wc->reglock, flags);
 #endif
 
 		if (x < DAHDI_CHUNKSIZE - 1) {
@@ -1901,6 +1905,7 @@
 static inline void t1_receiveprep(struct t1 *wc, const u8* readchunk)
 {
 	int x,chan;
+	unsigned long flags;
 	unsigned char expected;
 
 	if (!is_good_frame(readchunk))
@@ -1928,10 +1933,10 @@
 		}
 		cmd_decipher(wc, readchunk);
 #ifdef VPM_SUPPORT
-		spin_lock(&wc->reglock);
+		spin_lock_irqsave(&wc->reglock, flags);
 		if (wc->vpmadt032)
 			cmd_decipher_vpmadt032(wc, readchunk);
-		spin_unlock(&wc->reglock);
+		spin_unlock_irqrestore(&wc->reglock, flags);
 #endif
 		readchunk += (EFRAME_SIZE + EFRAME_GAP);
 	}
@@ -2049,6 +2054,7 @@
 
 static void te12xp_timer(unsigned long data)
 {
+	unsigned long flags;
 	struct t1 *wc = (struct t1 *)data;
 
 	if (unlikely(!test_bit(INITIALIZED, &wc->bit_flags)))
@@ -2056,7 +2062,7 @@
 
 	queue_work(wc->wq, &wc->timer_work);
 
-	spin_lock(&wc->reglock);
+	spin_lock_irqsave(&wc->reglock, flags);
 	if (!wc->vpmadt032)
 		goto unlock_exit;
 
@@ -2066,22 +2072,23 @@
 	queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
 
 unlock_exit:
-	spin_unlock(&wc->reglock);
+	spin_unlock_irqrestore(&wc->reglock, flags);
 	return;
 }
 
 static void t1_handle_error(struct voicebus *vb)
 {
+	unsigned long flags;
 	struct t1 *wc = container_of(vb, struct t1, vb);
 
-	spin_lock_bh(&wc->reglock);
+	spin_lock_irqsave(&wc->reglock, flags);
 	if (!wc->vpmadt032)
 		goto unlock_exit;
 	clear_bit(4, &wc->ctlreg);
 	queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
 
 unlock_exit:
-	spin_unlock_bh(&wc->reglock);
+	spin_unlock_irqrestore(&wc->reglock, flags);
 }
 
 static const struct voicebus_operations voicebus_operations = {




More information about the svn-commits mailing list