]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/8390/lib8390.c
Revert "8390 : Replace ei_debug with msg_enable/NETIF_MSG_* feature"
[~andy/linux] / drivers / net / ethernet / 8390 / lib8390.c
index d2cd80444ade7b5e5a6bdfe1f5e5207f8c02d798..b329f5c0d62b25203db832aa151dda371bcf4a1c 100644 (file)
 #define ei_block_input (ei_local->block_input)
 #define ei_get_8390_hdr (ei_local->get_8390_hdr)
 
+/* use 0 for production, 1 for verification, >2 for debug */
+#ifndef ei_debug
+int ei_debug = 1;
+#endif
+
 /* Index to functions. */
 static void ei_tx_intr(struct net_device *dev);
 static void ei_tx_err(struct net_device *dev);
@@ -111,11 +116,6 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
 static void do_set_multicast_list(struct net_device *dev);
 static void __NS8390_init(struct net_device *dev, int startp);
 
-static unsigned version_printed;
-static u32 msg_enable;
-module_param(msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
-MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
-
 /*
  *     SMP and the 8390 setup.
  *
@@ -345,23 +345,19 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
        if (ei_local->tx1 == 0) {
                output_page = ei_local->tx_start_page;
                ei_local->tx1 = send_length;
-               if ((netif_msg_tx_queued(ei_local)) &&
-                   ei_local->tx2 > 0)
-                       netdev_dbg(dev,
-                                  "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
+               if (ei_debug  &&  ei_local->tx2 > 0)
+                       netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
                                   ei_local->tx2, ei_local->lasttx, ei_local->txing);
        } else if (ei_local->tx2 == 0) {
                output_page = ei_local->tx_start_page + TX_PAGES/2;
                ei_local->tx2 = send_length;
-               if ((netif_msg_tx_queued(ei_local)) &&
-                   ei_local->tx1 > 0)
-                       netdev_dbg(dev,
-                                  "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
+               if (ei_debug  &&  ei_local->tx1 > 0)
+                       netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
                                   ei_local->tx1, ei_local->lasttx, ei_local->txing);
        } else {                        /* We should never get here. */
-               netif_dbg(ei_local, tx_err, dev,
-                         "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
-                         ei_local->tx1, ei_local->tx2, ei_local->lasttx);
+               if (ei_debug)
+                       netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
+                                  ei_local->tx1, ei_local->tx2, ei_local->lasttx);
                ei_local->irqlock = 0;
                netif_stop_queue(dev);
                ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR);
@@ -392,7 +388,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
        } else
                ei_local->txqueue++;
 
-       if (ei_local->tx1 && ei_local->tx2)
+       if (ei_local->tx1  &&  ei_local->tx2)
                netif_stop_queue(dev);
        else
                netif_start_queue(dev);
@@ -449,8 +445,9 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
 
        /* Change to page 0 and read the intr status reg. */
        ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
-       netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
-                 ei_inb_p(e8390_base + EN0_ISR));
+       if (ei_debug > 3)
+               netdev_dbg(dev, "interrupt(isr=%#2.2x)\n",
+                          ei_inb_p(e8390_base + EN0_ISR));
 
        /* !!Assumption!! -- we stay in page 0.  Don't break this. */
        while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 &&
@@ -488,7 +485,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
                ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
        }
 
-       if (interrupts && (netif_msg_intr(ei_local))) {
+       if (interrupts && ei_debug) {
                ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
                if (nr_serviced >= MAX_SERVICE) {
                        /* 0xFF is valid for a card removal */
@@ -679,11 +676,10 @@ static void ei_receive(struct net_device *dev)
                   Keep quiet if it looks like a card removal. One problem here
                   is that some clones crash in roughly the same way.
                 */
-               if ((netif_msg_rx_status(ei_local)) &&
+               if (ei_debug > 0 &&
                    this_frame != ei_local->current_page &&
                    (this_frame != 0x0 || rxing_page != 0xFF))
-                       netdev_err(dev,
-                                  "mismatched read page pointers %2x vs %2x\n",
+                       netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
                                   this_frame, ei_local->current_page);
 
                if (this_frame == rxing_page)   /* Read all the frames? */
@@ -711,10 +707,10 @@ static void ei_receive(struct net_device *dev)
                }
 
                if (pkt_len < 60  ||  pkt_len > 1518) {
-                       netif_dbg(ei_local, rx_status, dev,
-                                 "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
-                                 rx_frame.count, rx_frame.status,
-                                 rx_frame.next);
+                       if (ei_debug)
+                               netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
+                                          rx_frame.count, rx_frame.status,
+                                          rx_frame.next);
                        dev->stats.rx_errors++;
                        dev->stats.rx_length_errors++;
                } else if ((pkt_stat & 0x0F) == ENRSR_RXOK) {
@@ -722,9 +718,9 @@ static void ei_receive(struct net_device *dev)
 
                        skb = netdev_alloc_skb(dev, pkt_len + 2);
                        if (skb == NULL) {
-                               netif_err(ei_local, rx_err, dev,
-                                         "Couldn't allocate a sk_buff of size %d\n",
-                                         pkt_len);
+                               if (ei_debug > 1)
+                                       netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n",
+                                                  pkt_len);
                                dev->stats.rx_dropped++;
                                break;
                        } else {
@@ -740,10 +736,10 @@ static void ei_receive(struct net_device *dev)
                                        dev->stats.multicast++;
                        }
                } else {
-                       netif_err(ei_local, rx_err, dev,
-                                 "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
-                                 rx_frame.status, rx_frame.next,
-                                 rx_frame.count);
+                       if (ei_debug)
+                               netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
+                                          rx_frame.status, rx_frame.next,
+                                          rx_frame.count);
                        dev->stats.rx_errors++;
                        /* NB: The NIC counts CRC, frame and missed errors. */
                        if (pkt_stat & ENRSR_FO)
@@ -793,7 +789,8 @@ static void ei_rx_overrun(struct net_device *dev)
        was_txing = ei_inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
        ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
 
-       netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
+       if (ei_debug > 1)
+               netdev_dbg(dev, "Receiver overrun\n");
        dev->stats.rx_over_errors++;
 
        /*
@@ -968,9 +965,8 @@ static void __ei_set_multicast_list(struct net_device *dev)
 static void ethdev_setup(struct net_device *dev)
 {
        struct ei_device *ei_local = netdev_priv(dev);
-
-       if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
-               pr_info("%s", version);
+       if (ei_debug > 1)
+               printk(version);
 
        ether_setup(dev);
 
@@ -1039,10 +1035,9 @@ static void __NS8390_init(struct net_device *dev, int startp)
        ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
        for (i = 0; i < 6; i++) {
                ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
-               if ((netif_msg_probe(ei_local)) &&
+               if (ei_debug > 1 &&
                    ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i)) != dev->dev_addr[i])
-                       netdev_err(dev,
-                                  "Hw. address read/write mismap %d\n", i);
+                       netdev_err(dev, "Hw. address read/write mismap %d\n", i);
        }
 
        ei_outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);