remove ASSERT and remove all its callers altogether in the code Signed-off-by: Devendra Naga <devendra.aaru@xxxxxxxxx> --- drivers/staging/slicoss/slicoss.c | 140 +------------------------------------ 1 file changed, 2 insertions(+), 138 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 6af8fb4..9454280 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -142,39 +142,12 @@ static DEFINE_PCI_DEVICE_TABLE(slic_pci_tbl) = { MODULE_DEVICE_TABLE(pci, slic_pci_tbl); -#ifdef ASSERT -#undef ASSERT -#endif - -static void slic_assert_fail(void) -{ - u32 cpuid; - u32 curr_pid; - cpuid = smp_processor_id(); - curr_pid = current->pid; - - printk(KERN_ERR "%s CPU # %d ---- PID # %d\n", - __func__, cpuid, curr_pid); -} - -#ifndef ASSERT -#define ASSERT(a) do { \ - if (!(a)) { \ - printk(KERN_ERR "slicoss ASSERT() Failure: function %s" \ - "line %d\n", __func__, __LINE__); \ - slic_assert_fail(); \ - } \ -} while (0) -#endif - - #define SLIC_GET_SLIC_HANDLE(_adapter, _pslic_handle) \ { \ spin_lock_irqsave(&_adapter->handle_lock.lock, \ _adapter->handle_lock.flags); \ _pslic_handle = _adapter->pfree_slic_handles; \ if (_pslic_handle) { \ - ASSERT(_pslic_handle->type == SLIC_HANDLE_FREE); \ _adapter->pfree_slic_handles = _pslic_handle->next; \ } \ spin_unlock_irqrestore(&_adapter->handle_lock.lock, \ @@ -325,11 +298,8 @@ static void slic_timer_ping(ulong dev) struct adapter *adapter; struct sliccard *card; - ASSERT(dev); adapter = netdev_priv((struct net_device *)dev); - ASSERT(adapter); card = adapter->card; - ASSERT(card); adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ); add_timer(&adapter->pingtimer); @@ -361,9 +331,6 @@ static void slic_link_config(struct adapter *adapter, if (adapter->state != ADAPT_UP) return; - ASSERT((adapter->devid == SLIC_1GB_DEVICE_ID) - || (adapter->devid == SLIC_2GB_DEVICE_ID)); - if (linkspeed > LINK_1000MB) linkspeed = LINK_AUTOSPEED; if (linkduplex > LINK_AUTOD) @@ -603,7 +570,6 @@ static int slic_card_download(struct adapter *adapter) } numsects = *(u32 *)(fw->data + index); index += 4; - ASSERT(numsects <= 3); for (i = 0; i < numsects; i++) { sectsize[i] = *(u32 *)(fw->data + index); index += 4; @@ -1059,8 +1025,6 @@ static void slic_upr_start(struct adapter *adapter) case SLIC_UPR_PING: slic_reg32_write(&slic_regs->slic_ping, 1, FLUSH); break; - default: - ASSERT(0); } } @@ -1115,9 +1079,6 @@ static void slic_link_upr_complete(struct adapter *adapter, u32 isr) if (adapter->state != ADAPT_UP) return; - ASSERT((adapter->devid == SLIC_1GB_DEVICE_ID) - || (adapter->devid == SLIC_2GB_DEVICE_ID)); - linkup = linkstatus & GIG_LINKUP ? LINK_UP : LINK_DOWN; if (linkstatus & GIG_SPEED_1000) linkspeed = LINK_1000MB; @@ -1169,7 +1130,6 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) spin_lock_irqsave(&adapter->upr_lock.lock, adapter->upr_lock.flags); upr = adapter->upr_list; if (!upr) { - ASSERT(0); spin_unlock_irqrestore(&adapter->upr_lock.lock, adapter->upr_lock.flags); return; @@ -1177,7 +1137,6 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) adapter->upr_list = upr->next; upr->next = NULL; adapter->upr_busy = 0; - ASSERT(adapter->port == upr->adapter); switch (upr->upr_request) { case SLIC_UPR_STATS: { @@ -1259,23 +1218,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; case SLIC_UPR_RCONFIG: break; - case SLIC_UPR_RPHY: - ASSERT(0); - break; - case SLIC_UPR_ENLB: - ASSERT(0); - break; - case SLIC_UPR_ENCT: - ASSERT(0); - break; - case SLIC_UPR_PDWN: - ASSERT(0); - break; case SLIC_UPR_PING: card->pingstatus |= (isr & ISR_PINGDSMASK); break; - default: - ASSERT(0); } kfree(upr); slic_upr_start(adapter); @@ -1291,7 +1236,6 @@ static void slic_config_get(struct adapter *adapter, u32 config, status = slic_upr_request(adapter, SLIC_UPR_RCONFIG, (u32) config, (u32) config_h, 0, 0); - ASSERT(status == 0); } /* @@ -1421,7 +1365,6 @@ static int slic_rspqueue_init(struct adapter *adapter) __iomem struct slic_regs *slic_regs = adapter->slic_regs; u32 paddrh = 0; - ASSERT(adapter->state == ADAPT_DOWN); memset(rspq, 0, sizeof(struct slic_rspqueue)); rspq->num_pages = SLIC_RSPQ_PAGES_GB; @@ -1438,14 +1381,6 @@ static int slic_rspqueue_init(struct adapter *adapter) } /* FIXME: * do we really need this assertions (4K PAGE_SIZE aligned addr)? */ -#if 0 -#ifndef CONFIG_X86_64 - ASSERT(((u32) rspq->vaddr[i] & 0xFFFFF000) == - (u32) rspq->vaddr[i]); - ASSERT(((u32) rspq->paddr[i] & 0xFFFFF000) == - (u32) rspq->paddr[i]); -#endif -#endif memset(rspq->vaddr[i], 0, PAGE_SIZE); if (paddrh == 0) { @@ -1474,18 +1409,9 @@ static struct slic_rspbuf *slic_rspqueue_getnext(struct adapter *adapter) return NULL; buf = rspq->rspbuf; -#if BITS_PER_LONG == 32 - ASSERT((buf->status & 0xFFFFFFE0) == 0); -#endif - ASSERT(buf->hosthandle); if (++rspq->offset < SLIC_RSPQ_BUFSINPAGE) { rspq->rspbuf++; -#if BITS_PER_LONG == 32 - ASSERT(((u32) rspq->rspbuf & 0xFFFFFFE0) == - (u32) rspq->rspbuf); -#endif } else { - ASSERT(rspq->offset == SLIC_RSPQ_BUFSINPAGE); slic_reg64_write(adapter, &adapter->slic_regs->slic_rbar64, (rspq->paddr[rspq->pageindex] | SLIC_RSPQ_BUFSINPAGE), &adapter->slic_regs->slic_addr_upper, 0, DONT_FLUSH); @@ -1493,14 +1419,8 @@ static struct slic_rspbuf *slic_rspqueue_getnext(struct adapter *adapter) rspq->offset = 0; rspq->rspbuf = (struct slic_rspbuf *) rspq->vaddr[rspq->pageindex]; -#if BITS_PER_LONG == 32 - ASSERT(((u32) rspq->rspbuf & 0xFFFFF000) == - (u32) rspq->rspbuf); -#endif } -#if BITS_PER_LONG == 32 - ASSERT(((u32) buf & 0xFFFFFFE0) == (u32) buf); -#endif + return buf; } @@ -1539,9 +1459,7 @@ static u32 *slic_cmdqmem_addpage(struct adapter *adapter) &cmdqmem->dma_pages[cmdqmem->pagecnt]); if (!pageaddr) return NULL; -#if BITS_PER_LONG == 32 - ASSERT(((u32) pageaddr & 0xFFFFF000) == (u32) pageaddr); -#endif + cmdqmem->pages[cmdqmem->pagecnt] = pageaddr; cmdqmem->pagecnt++; return pageaddr; @@ -1597,11 +1515,6 @@ static void slic_cmdq_addcmdpage(struct adapter *adapter, u32 *page) (adapter->slic_handle_ix < 256)) { /* Allocate and initialize a SLIC_HANDLE for this command */ SLIC_GET_SLIC_HANDLE(adapter, pslic_handle); - if (pslic_handle == NULL) - ASSERT(0); - ASSERT(pslic_handle == - &adapter->slic_handles[pslic_handle->token. - handle_index]); pslic_handle->type = SLIC_HANDLE_CMD; pslic_handle->address = (void *) cmd; pslic_handle->offset = (ushort) adapter->slic_handle_ix++; @@ -1640,7 +1553,6 @@ static int slic_cmdq_init(struct adapter *adapter) int i; u32 *pageaddr; - ASSERT(adapter->state == ADAPT_DOWN); memset(&adapter->cmdq_all, 0, sizeof(struct slic_cmdqueue)); memset(&adapter->cmdq_free, 0, sizeof(struct slic_cmdqueue)); memset(&adapter->cmdq_done, 0, sizeof(struct slic_cmdqueue)); @@ -1651,9 +1563,6 @@ static int slic_cmdq_init(struct adapter *adapter) adapter->slic_handle_ix = 1; for (i = 0; i < SLIC_CMDQ_INITPAGES; i++) { pageaddr = slic_cmdqmem_addpage(adapter); -#if BITS_PER_LONG == 32 - ASSERT(((u32) pageaddr & 0xFFFFF000) == (u32) pageaddr); -#endif if (!pageaddr) { slic_cmdq_free(adapter); return -ENOMEM; @@ -1681,7 +1590,6 @@ static void slic_cmdq_reset(struct adapter *adapter) while (hcmd) { if (hcmd->busy) { skb = hcmd->skb; - ASSERT(skb); hcmd->busy = 0; hcmd->skb = NULL; dev_kfree_skb_irq(skb); @@ -1717,7 +1625,6 @@ static void slic_cmdq_getdone(struct adapter *adapter) struct slic_cmdqueue *done_cmdq = &adapter->cmdq_done; struct slic_cmdqueue *free_cmdq = &adapter->cmdq_free; - ASSERT(free_cmdq->head == NULL); spin_lock_irqsave(&done_cmdq->lock.lock, done_cmdq->lock.flags); free_cmdq->head = done_cmdq->head; @@ -1883,7 +1790,6 @@ static int slic_rcvqueue_init(struct adapter *adapter) int i, count; struct slic_rcvqueue *rcvq = &adapter->rcvqueue; - ASSERT(adapter->state == ADAPT_DOWN); rcvq->tail = NULL; rcvq->head = NULL; rcvq->size = SLIC_RCVQ_ENTRIES; @@ -1912,7 +1818,6 @@ static struct sk_buff *slic_rcvqueue_getnext(struct adapter *adapter) if (rcvq->count) { skb = rcvq->head; rcvbuf = (struct slic_rcvbuf *)skb->head; - ASSERT(rcvbuf); if (rcvbuf->status & IRHDDR_SVALID) { rcvq->head = rcvq->head->next; @@ -1945,8 +1850,6 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb) struct slic_rcvbuf *rcvbuf = (struct slic_rcvbuf *)skb->head; struct device *dev; - ASSERT(skb->len == SLIC_RCVBUF_HEADSIZE); - paddr = (void *)pci_map_single(adapter->pcidev, skb->head, SLIC_RCVQ_RCVBUFSIZE, PCI_DMA_FROMDEVICE); rcvbuf->status = 0; @@ -2018,7 +1921,6 @@ static int slic_debug_card_show(struct seq_file *seq, void *v) card->adapters_activated); seq_printf(seq, " Allocated : %d\n", card->adapters_allocated); - ASSERT(card->card_size <= SLIC_NBR_MACS); for (i = 0; i < card->card_size; i++) { seq_printf(seq, " MAC%d : %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", @@ -2459,7 +2361,6 @@ static void slic_link_event_handler(struct adapter *adapter) (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */ 0, 0, 0); #endif - ASSERT(status == 0); } static void slic_init_cleanup(struct adapter *adapter) @@ -2523,8 +2424,6 @@ static void slic_mcast_set_list(struct net_device *dev) char *addresses; struct netdev_hw_addr *ha; - ASSERT(adapter); - netdev_for_each_mc_addr(ha, dev) { addresses = (char *) &ha->addr; status = slic_mcast_add_list(adapter, addresses); @@ -2611,8 +2510,6 @@ static void slic_xmit_fail(struct adapter *adapter, "xmit_start skb[%p] type[%x] No host commands " "available\n", skb, skb->pkt_type); break; - default: - ASSERT(0); } } dev_kfree_skb(skb); @@ -2724,7 +2621,6 @@ static void slic_rcv_handler(struct adapter *adapter) while ((skb = slic_rcvqueue_getnext(adapter))) { u32 rx_bytes; - ASSERT(skb->head); rcvbuf = (struct slic_rcvbuf *)skb->head; adapter->card->events++; if (rcvbuf->status & IRHDDR_ERR) { @@ -2780,16 +2676,11 @@ static void slic_xmit_complete(struct adapter *adapter) Get the complete host command buffer */ slic_handle_word.handle_token = rspbuf->hosthandle; - ASSERT(slic_handle_word.handle_index); - ASSERT(slic_handle_word.handle_index <= SLIC_CMDQ_MAXCMDS); hcmd = (struct slic_hostcmd *) adapter->slic_handles[slic_handle_word.handle_index]. address; /* hcmd = (struct slic_hostcmd *) rspbuf->hosthandle; */ - ASSERT(hcmd); - ASSERT(hcmd->pslic_handle == - &adapter->slic_handles[slic_handle_word.handle_index]); if (hcmd->type == SLIC_CMD_DUMB) { if (hcmd->skb) dev_kfree_skb_irq(hcmd->skb); @@ -2910,7 +2801,6 @@ static netdev_tx_t slic_xmit_start(struct sk_buff *skb, struct net_device *dev) void *offloadcmd = NULL; card = adapter->card; - ASSERT(card); if ((adapter->linkstate != LINK_UP) || (adapter->state != ADAPT_UP) || (card->state != CARD_UP)) { status = XMIT_FAIL_LINK_STATE; @@ -2928,9 +2818,6 @@ static netdev_tx_t slic_xmit_start(struct sk_buff *skb, struct net_device *dev) status = XMIT_FAIL_HOSTCMD_FAIL; goto xmit_fail; } - ASSERT(hcmd->pslic_handle); - ASSERT(hcmd->cmd64.hosthandle == - hcmd->pslic_handle->token.handle_token); hcmd->skb = skb; hcmd->busy = 1; hcmd->type = SLIC_CMD_DUMB; @@ -3023,8 +2910,6 @@ static int slic_if_init(struct adapter *adapter) struct slic_shmem *pshmem; int rc; - ASSERT(card); - /* adapter should be down at this point */ if (adapter->state != ADAPT_DOWN) { dev_err(&dev->dev, "%s: adapter->state != ADAPT_DOWN\n", @@ -3032,7 +2917,6 @@ static int slic_if_init(struct adapter *adapter) rc = -EIO; goto err; } - ASSERT(adapter->linkstate == LINK_DOWN); adapter->devflags_prev = dev->flags; adapter->macopts = MAC_DIRECTED; @@ -3132,9 +3016,6 @@ static int slic_entry_open(struct net_device *dev) struct sliccard *card = adapter->card; int status; - ASSERT(adapter); - ASSERT(card); - netif_stop_queue(adapter->netdev); spin_lock_irqsave(&slic_global.driver_lock.lock, @@ -3201,9 +3082,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev) mlist = mlist->next; kfree(mcaddr); } - ASSERT(adapter->card); card = adapter->card; - ASSERT(card->adapters_allocated); card->adapters_allocated--; adapter->allocated = 0; if (!card->adapters_allocated) { @@ -3213,10 +3092,8 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev) } else { while (curr_card->next != card) curr_card = curr_card->next; - ASSERT(curr_card); curr_card->next = card->next; } - ASSERT(slic_global.num_slic_cards); slic_global.num_slic_cards--; slic_card_cleanup(card); } @@ -3233,14 +3110,12 @@ static int slic_entry_halt(struct net_device *dev) spin_lock_irqsave(&slic_global.driver_lock.lock, slic_global.driver_lock.flags); - ASSERT(card); netif_stop_queue(adapter->netdev); adapter->state = ADAPT_DOWN; adapter->linkstate = LINK_DOWN; adapter->upr_list = NULL; adapter->upr_busy = 0; adapter->devflags_prev = 0; - ASSERT(card->adapter[adapter->cardindex] == adapter); slic_reg32_write(&slic_regs->slic_icr, ICR_INT_OFF, FLUSH); adapter->all_reg_writes++; adapter->icr_reg_writes++; @@ -3272,7 +3147,6 @@ static struct net_device_stats *slic_get_stats(struct net_device *dev) { struct adapter *adapter = netdev_priv(dev); - ASSERT(adapter); dev->stats.collisions = adapter->slic_stats.iface.xmit_collisions; dev->stats.rx_errors = adapter->slic_stats.iface.rcv_errors; dev->stats.tx_errors = adapter->slic_stats.iface.xmt_errors; @@ -3295,7 +3169,6 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) u32 data[7]; u32 intagg; - ASSERT(rq); switch (cmd) { case SIOCSLICSETINTAGG: if (copy_from_user(data, rq->ifr_data, 28)) @@ -3341,7 +3214,6 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } #endif case SIOCETHTOOL: - ASSERT(adapter); if (copy_from_user(&ecmd, rq->ifr_data, sizeof(ecmd))) return -EFAULT; @@ -3681,7 +3553,6 @@ static void slic_init_adapter(struct net_device *netdev, /* Initialize slic_handle array */ - ASSERT(SLIC_CMDQ_MAXCMDS <= 0xFFFF); /* Start with 1. 0 is an invalid host handle. */ @@ -3698,8 +3569,6 @@ static void slic_init_adapter(struct net_device *netdev, sizeof(struct slic_shmem), &adapter-> phys_shmem); - ASSERT(adapter->pshmem); - if (adapter->pshmem) memset(adapter->pshmem, 0, sizeof(struct slic_shmem)); } @@ -3774,11 +3643,9 @@ static u32 slic_card_locate(struct adapter *adapter) } } - ASSERT(card); if (!card) return -ENXIO; /* Put the adapter in the card's adapter list */ - ASSERT(card->adapter[adapter->port] == NULL); if (!card->adapter[adapter->port]) { card->adapter[adapter->port] = adapter; adapter->card = card; @@ -3793,7 +3660,6 @@ static u32 slic_card_locate(struct adapter *adapter) else break; } - ASSERT(i != SLIC_MAX_PORTS); if (physcard->adapter[i]->slotnumber == adapter->slotnumber) break; physcard = physcard->next; @@ -3801,7 +3667,6 @@ static u32 slic_card_locate(struct adapter *adapter) if (!physcard) { /* no structure allocated for this physical card yet */ physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC); - ASSERT(physcard); physcard->next = slic_global.phys_card; slic_global.phys_card = physcard; @@ -3812,7 +3677,6 @@ static u32 slic_card_locate(struct adapter *adapter) /* Note - this is ZERO relative */ adapter->physport = physcard->adapters_allocd - 1; - ASSERT(physcard->adapter[adapter->physport] == NULL); physcard->adapter[adapter->physport] = adapter; adapter->physcard = physcard; -- 1.7.9.5 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel