[PATCH] BUG_ON() Conversion in net/tulip/de2104x.c

hi,

this changes if() BUG(); constructs to BUG_ON() which is
cleaner and can better optimized away

One of the if()s contains a call to de_is_running(),
which seems to be safe to replace, but someone with more
knownledge of the code might want to verify this...

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
Eric Sesterhenn / snakebyte 2006-01-26 22:02:43 +01:00 committed by Jeff Garzik
parent a707cd6e2d
commit 7e0b58f32f

View File

@ -402,8 +402,7 @@ static void de_rx (struct de_private *de)
unsigned copying_skb, buflen; unsigned copying_skb, buflen;
skb = de->rx_skb[rx_tail].skb; skb = de->rx_skb[rx_tail].skb;
if (!skb) BUG_ON(!skb);
BUG();
rmb(); rmb();
status = le32_to_cpu(de->rx_ring[rx_tail].opts1); status = le32_to_cpu(de->rx_ring[rx_tail].opts1);
if (status & DescOwn) if (status & DescOwn)
@ -545,8 +544,7 @@ static void de_tx (struct de_private *de)
break; break;
skb = de->tx_skb[tx_tail].skb; skb = de->tx_skb[tx_tail].skb;
if (!skb) BUG_ON(!skb);
BUG();
if (unlikely(skb == DE_DUMMY_SKB)) if (unlikely(skb == DE_DUMMY_SKB))
goto next; goto next;
@ -789,8 +787,7 @@ static void __de_set_rx_mode (struct net_device *dev)
de->tx_head = NEXT_TX(entry); de->tx_head = NEXT_TX(entry);
if (TX_BUFFS_AVAIL(de) < 0) BUG_ON(TX_BUFFS_AVAIL(de) < 0);
BUG();
if (TX_BUFFS_AVAIL(de) == 0) if (TX_BUFFS_AVAIL(de) == 0)
netif_stop_queue(dev); netif_stop_queue(dev);
@ -916,8 +913,7 @@ static void de_set_media (struct de_private *de)
unsigned media = de->media_type; unsigned media = de->media_type;
u32 macmode = dr32(MacMode); u32 macmode = dr32(MacMode);
if (de_is_running(de)) BUG_ON(de_is_running(de));
BUG();
if (de->de21040) if (de->de21040)
dw32(CSR11, FULL_DUPLEX_MAGIC); dw32(CSR11, FULL_DUPLEX_MAGIC);
@ -1153,8 +1149,7 @@ static void de_media_interrupt (struct de_private *de, u32 status)
return; return;
} }
if (!(status & LinkFail)) BUG_ON(!(status & LinkFail));
BUG();
if (netif_carrier_ok(de->dev)) { if (netif_carrier_ok(de->dev)) {
de_link_down(de); de_link_down(de);
@ -2092,8 +2087,7 @@ static void __exit de_remove_one (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct de_private *de = dev->priv; struct de_private *de = dev->priv;
if (!dev) BUG_ON(!dev);
BUG();
unregister_netdev(dev); unregister_netdev(dev);
kfree(de->ee_data); kfree(de->ee_data);
iounmap(de->regs); iounmap(de->regs);