[svn-commits] sruffell: linux/trunk r7523 - /linux/trunk/drivers/dahdi/voicebus/voicebus.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 6 18:35:51 CST 2009


Author: sruffell
Date: Fri Nov  6 18:35:44 2009
New Revision: 7523

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7523
Log:
voicebus: Remove 'assert' macros and use BUG_ON/WARN_ON directly.

Modified:
    linux/trunk/drivers/dahdi/voicebus/voicebus.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=7523&r1=7522&r2=7523
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Fri Nov  6 18:35:44 2009
@@ -40,8 +40,6 @@
 #include "voicebus.h"
 #include "vpmadtreg.h"
 #include "GpakCust.h"
-
-#define assert(__x__) BUG_ON(!(__x__))
 
 #define INTERRUPT 0	/* Run the deferred processing in the ISR. */
 #define TASKLET 1	/* Run in a tasklet. */
@@ -270,30 +268,6 @@
 #endif
 #endif
 
-#ifdef DBG
-static inline int
-assert_in_vb_deferred(struct voicebus *vb)
-{
-	assert(test_bit(IN_DEFERRED_PROCESSING, &vb->flags));
-}
-
-static inline void
-start_vb_deferred(struct voicebus *vb)
-{
-	set_bit(IN_DEFERRED_PROCESSING, &vb->flags);
-}
-
-static inline void
-stop_vb_deferred(struct voicebus *vb)
-{
-	clear_bit(IN_DEFERRED_PROCESSING, &vb->flags);
-}
-#else
-#define assert_in_vb_deferred(_x_)  do {; } while (0)
-#define start_vb_deferred(_x_) do {; } while (0)
-#define stop_vb_deferred(_x_) do {; } while (0)
-#endif
-
 static inline struct voicebus_descriptor *
 vb_descriptor(const struct voicebus_descriptor_list *dl,
 	      const unsigned int index)
@@ -312,7 +286,7 @@
 	struct voicebus_descriptor *d;
 	const u32 END_OF_RING = 0x02000000;
 
-	assert(dl);
+	BUG_ON(!dl);
 
 	/*
 	 * Add some padding to each descriptor to ensure that they are
@@ -549,7 +523,7 @@
 	struct voicebus_descriptor_list *dl = &vb->txd;
 	struct voicebus_descriptor *d;
 
-	assert(vb_is_stopped(vb));
+	BUG_ON(!vb_is_stopped(vb));
 
 	for (i = 0; i < DRING_SIZE; ++i) {
 		d = vb_descriptor(dl, i);
@@ -576,7 +550,7 @@
 	struct voicebus_descriptor_list *dl = &vb->rxd;
 	struct voicebus_descriptor *d;
 
-	assert(vb_is_stopped(vb));
+	BUG_ON(!vb_is_stopped(vb));
 
 	for (i = 0; i < DRING_SIZE; ++i) {
 		d = vb_descriptor(dl, i);
@@ -584,7 +558,7 @@
 			dma_unmap_single(&vb->pdev->dev, d->buffer1,
 					 vb->framesize, DMA_FROM_DEVICE);
 			d->buffer1 = 0;
-			assert(dl->pending[i]);
+			BUG_ON(!dl->pending[i]);
 			voicebus_free(vb, dl->pending[i]);
 			dl->pending[i] = NULL;
 		}
@@ -689,7 +663,7 @@
 {
 	LOCKS_VOICEBUS;
 	u32 reg;
-	assert(vb->pdev);
+	BUG_ON(!vb->pdev);
 	VBLOCK(vb);
 	pci_read_config_dword(vb->pdev, 0x0004, &reg);
 	reg |= 0x00000007;
@@ -849,7 +823,6 @@
 {
 	struct voicebus_descriptor *d;
 	struct voicebus_descriptor_list *dl = &vb->txd;
-	assert_in_vb_deferred(vb);
 
 	d = vb_descriptor(dl, dl->tail);
 
@@ -880,7 +853,6 @@
 	struct voicebus_descriptor *d;
 	struct voicebus_descriptor_list *dl = &vb->rxd;
 	unsigned int tail = dl->tail;
-	assert_in_vb_deferred(vb);
 
 	d = vb_descriptor(dl, tail);
 
@@ -920,7 +892,7 @@
 	struct voicebus_descriptor *d;
 	void *vbb;
 	unsigned int head = dl->head;
-	assert_in_vb_deferred(vb);
+
 	d = vb_descriptor(dl, head);
 
 	if (OWNED(d) || (d->buffer1 == vb->idle_vbb_dma_addr))
@@ -944,7 +916,6 @@
 	struct voicebus_descriptor_list *dl = &vb->rxd;
 	unsigned int head = dl->head;
 	void *vbb;
-	assert_in_vb_deferred(vb);
 
 	d = vb_descriptor(dl, head);
 
@@ -1053,8 +1024,6 @@
 	void *vbb;
 	int ret;
 
-	assert(!in_interrupt());
-
 	WARN_ON(pci_get_drvdata(vb->pdev) != vb);
 	if (pci_get_drvdata(vb->pdev) != vb)
 		return -EFAULT;
@@ -1080,7 +1049,6 @@
 	 *  is known to not be running at this point, it is safe to call the
 	 *  handle transmit as if it were.
 	 */
-	start_vb_deferred(vb);
 	/* Ensure that all the rx slots are ready for a buffer. */
 	for (i = 0; i < DRING_SIZE; ++i) {
 		vbb = voicebus_alloc(vb);
@@ -1102,7 +1070,6 @@
 			handle_transmit(vb, vbb);
 
 	}
-	stop_vb_deferred(vb);
 
 	VBLOCK(vb);
 	clear_bit(STOP, &vb->flags);
@@ -1123,7 +1090,7 @@
 	__vb_tx_demand_poll(vb);
 	VBUNLOCK(vb);
 
-	assert(!vb_is_stopped(vb));
+	BUG_ON(vb_is_stopped(vb));
 
 	return 0;
 }
@@ -1185,8 +1152,6 @@
 int
 voicebus_stop(struct voicebus *vb)
 {
-	assert(!in_interrupt());
-
 	if (vb_is_stopped(vb))
 		return 0;
 
@@ -1195,7 +1160,7 @@
 	vb_clear_start_transmit_bit(vb);
 	vb_clear_start_receive_bit(vb);
 	if (vb_wait_for_completion_timeout(&vb->stopped_completion, HZ)) {
-		assert(vb_is_stopped(vb));
+		BUG_ON(!vb_is_stopped(vb));
 	} else {
 		dev_warn(&vb->pdev->dev, "Timeout while waiting for board to "
 			 "stop.\n");
@@ -1244,7 +1209,6 @@
 void
 voicebus_release(struct voicebus *vb)
 {
-	assert(!in_interrupt());
 #ifdef CONFIG_VOICEBUS_SYSFS
 	device_remove_file(&vb->pdev->dev, &dev_attr_voicebus_current_latency);
 #endif
@@ -1280,8 +1244,6 @@
 {
 	void *vbb;
 	int i;
-
-	assert_in_vb_deferred(vb);
 
 	if (0 == increase)
 		return;
@@ -1451,8 +1413,6 @@
 	int softunderrun;
 
 	int underrun = test_bit(TX_UNDERRUN, &vb->flags);
-
-	start_vb_deferred(vb);
 
 	buffer_count = 0;
 
@@ -1563,8 +1523,6 @@
 		}
 		vb_submit_rxb(vb, vb->vbb_stash[0]);
 	}
-
-	stop_vb_deferred(vb);
 }
 
 /*!
@@ -1635,12 +1593,12 @@
 			dev_err(&vb->pdev->dev, "Fatal Bus Error detected!\n");
 
 		if (int_status & TX_STOPPED_INTERRUPT) {
-			assert(test_bit(STOP, &vb->flags));
+			BUG_ON(!test_bit(STOP, &vb->flags));
 			__vb_disable_interrupts(vb);
 			complete(&vb->stopped_completion);
 		}
 		if (int_status & RX_STOPPED_INTERRUPT) {
-			assert(test_bit(STOP, &vb->flags));
+			BUG_ON(!test_bit(STOP, &vb->flags));
 			if (vb_is_stopped(vb)) {
 				__vb_disable_interrupts(vb);
 				complete(&vb->stopped_completion);
@@ -1715,11 +1673,11 @@
 	int retval = 0;
 	struct voicebus *vb;
 
-	assert(NULL != pdev);
-	assert(NULL != board_name);
-	assert(framesize);
-	assert(NULL != handle_receive);
-	assert(NULL != handle_transmit);
+	BUG_ON(NULL == pdev);
+	BUG_ON(NULL == board_name);
+	BUG_ON(0 == framesize);
+	BUG_ON(NULL == handle_receive);
+	BUG_ON(NULL == handle_transmit);
 
 	/* ----------------------------------------------------------------
 	   Initialize the pure software constructs.
@@ -1866,7 +1824,7 @@
 #if VOICEBUS_DEFERRED != TIMER
 	if (request_irq(pdev->irq, vb_isr, DAHDI_IRQ_SHARED, board_name,
 		vb)) {
-		assert(0);
+		BUG_ON(1);
 		goto cleanup;
 	}
 #endif
@@ -1906,7 +1864,7 @@
 		pci_disable_device(vb->pdev);
 
 	kfree(vb);
-	assert(0 != retval);
+	WARN_ON(0 == retval);
 	return retval;
 }
 EXPORT_SYMBOL(voicebus_init);




More information about the svn-commits mailing list