[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-wcte12xp-latency r8797 - in /linu...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Jun 23 15:38:49 CDT 2010


Author: sruffell
Date: Wed Jun 23 15:38:44 2010
New Revision: 8797

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8797
Log:
voicebus: spin_lock_bh -> spin_lock_irqsave

This is necessary because a future patch will add an option to run the
"tasklet" directly in the interrupt handler.

Modified:
    linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c
    linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h
    linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wcte12xp/base.c

Modified: linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8797&r1=8796&r2=8797
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c Wed Jun 23 15:38:44 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/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h?view=diff&rev=8797&r1=8796&r2=8797
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h Wed Jun 23 15:38:44 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/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8797&r1=8796&r2=8797
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wctdm24xxp/base.c Wed Jun 23 15:38:44 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/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8797&r1=8796&r2=8797
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/wcte12xp/base.c Wed Jun 23 15:38:44 2010
@@ -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__);
@@ -1404,6 +1406,7 @@
 static int check_and_load_vpm(struct t1 *wc)
 {
 	int res;
+	unsigned long flags;
 	struct vpmadt032_options options;
 
 	if (!vpmsupport) {
@@ -1442,9 +1445,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;
 
@@ -2069,16 +2072,17 @@
 
 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 dahdi-commits mailing list