aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Leon <santil@linux.vnet.ibm.com>2010-09-03 14:29:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-06 21:21:55 -0400
commit6485911a5c04c328939113528805f15b90ae28cf (patch)
tree8f3bad7bf57307715f2edbd61a286bc4562a3dae
parentbe35ae9e08dbbc70f1cd50de8639627fa501692d (diff)
ibmveth: Convert driver specific assert to BUG_ON
We had a driver specific assert function which wasn't enabled most of the time. Convert them to BUG_ON and enable them all the time. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ibmveth.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 11086dbe76e8..82cbf507f73e 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -53,18 +53,6 @@
53 53
54#include "ibmveth.h" 54#include "ibmveth.h"
55 55
56#undef DEBUG
57
58#ifdef DEBUG
59#define ibmveth_assert(expr) \
60 if (!(expr)) { \
61 printk(KERN_DEBUG "assertion failed (%s:%3.3d ua:%x): %s\n", __FILE__, __LINE__, adapter->vdev->unit_address, #expr); \
62 BUG(); \
63 }
64#else
65#define ibmveth_assert(expr)
66#endif
67
68static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance); 56static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance);
69static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter); 57static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter);
70static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev); 58static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev);
@@ -251,8 +239,8 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter,
251 pool->consumer_index = 0; 239 pool->consumer_index = 0;
252 index = pool->free_map[free_index]; 240 index = pool->free_map[free_index];
253 241
254 ibmveth_assert(index != IBM_VETH_INVALID_MAP); 242 BUG_ON(index == IBM_VETH_INVALID_MAP);
255 ibmveth_assert(pool->skbuff[index] == NULL); 243 BUG_ON(pool->skbuff[index] != NULL);
256 244
257 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, 245 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
258 pool->buff_size, DMA_FROM_DEVICE); 246 pool->buff_size, DMA_FROM_DEVICE);
@@ -371,12 +359,12 @@ static void ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
371 unsigned int free_index; 359 unsigned int free_index;
372 struct sk_buff *skb; 360 struct sk_buff *skb;
373 361
374 ibmveth_assert(pool < IBMVETH_NUM_BUFF_POOLS); 362 BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS);
375 ibmveth_assert(index < adapter->rx_buff_pool[pool].size); 363 BUG_ON(index >= adapter->rx_buff_pool[pool].size);
376 364
377 skb = adapter->rx_buff_pool[pool].skbuff[index]; 365 skb = adapter->rx_buff_pool[pool].skbuff[index];
378 366
379 ibmveth_assert(skb != NULL); 367 BUG_ON(skb == NULL);
380 368
381 adapter->rx_buff_pool[pool].skbuff[index] = NULL; 369 adapter->rx_buff_pool[pool].skbuff[index] = NULL;
382 370
@@ -404,8 +392,8 @@ static inline struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *ada
404 unsigned int pool = correlator >> 32; 392 unsigned int pool = correlator >> 32;
405 unsigned int index = correlator & 0xffffffffUL; 393 unsigned int index = correlator & 0xffffffffUL;
406 394
407 ibmveth_assert(pool < IBMVETH_NUM_BUFF_POOLS); 395 BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS);
408 ibmveth_assert(index < adapter->rx_buff_pool[pool].size); 396 BUG_ON(index >= adapter->rx_buff_pool[pool].size);
409 397
410 return adapter->rx_buff_pool[pool].skbuff[index]; 398 return adapter->rx_buff_pool[pool].skbuff[index];
411} 399}
@@ -420,8 +408,8 @@ static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter)
420 union ibmveth_buf_desc desc; 408 union ibmveth_buf_desc desc;
421 unsigned long lpar_rc; 409 unsigned long lpar_rc;
422 410
423 ibmveth_assert(pool < IBMVETH_NUM_BUFF_POOLS); 411 BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS);
424 ibmveth_assert(index < adapter->rx_buff_pool[pool].size); 412 BUG_ON(index >= adapter->rx_buff_pool[pool].size);
425 413
426 if (!adapter->rx_buff_pool[pool].active) { 414 if (!adapter->rx_buff_pool[pool].active) {
427 ibmveth_rxq_harvest_buffer(adapter); 415 ibmveth_rxq_harvest_buffer(adapter);
@@ -1181,7 +1169,7 @@ restart_poll:
1181 lpar_rc = h_vio_signal(adapter->vdev->unit_address, 1169 lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1182 VIO_IRQ_ENABLE); 1170 VIO_IRQ_ENABLE);
1183 1171
1184 ibmveth_assert(lpar_rc == H_SUCCESS); 1172 BUG_ON(lpar_rc != H_SUCCESS);
1185 1173
1186 napi_complete(napi); 1174 napi_complete(napi);
1187 1175
@@ -1205,7 +1193,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance)
1205 if (napi_schedule_prep(&adapter->napi)) { 1193 if (napi_schedule_prep(&adapter->napi)) {
1206 lpar_rc = h_vio_signal(adapter->vdev->unit_address, 1194 lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1207 VIO_IRQ_DISABLE); 1195 VIO_IRQ_DISABLE);
1208 ibmveth_assert(lpar_rc == H_SUCCESS); 1196 BUG_ON(lpar_rc != H_SUCCESS);
1209 __napi_schedule(&adapter->napi); 1197 __napi_schedule(&adapter->napi);
1210 } 1198 }
1211 return IRQ_HANDLED; 1199 return IRQ_HANDLED;