Re: [patch 15/22] NET: DM9000: Use netif_msg to enable debugging options

2007-11-23 Thread Jeff Garzik

ah, you took care of my comment regarding an earlier patch.

consider that comment rescinded


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 15/22] NET: DM9000: Use netif_msg to enable debugging options

2007-11-19 Thread Ben Dooks
Use the netif_msg_*() macros to enable the debugging based
on the board's msg_enable field. The output still goes via
the dev_dbg() macros, so will be tagged and output as 
appropriate.

Signed-off-by: Ben Dooks [EMAIL PROTECTED]

Index: linux-2.6.23-quilt4/drivers/net/dm9000.c
===
--- linux-2.6.23-quilt4.orig/drivers/net/dm9000.c
+++ linux-2.6.23-quilt4/drivers/net/dm9000.c
@@ -745,7 +745,8 @@ dm9000_open(struct net_device *dev)
board_info_t *db = (board_info_t *) dev-priv;
unsigned long irqflags = IRQF_SHARED;
 
-   dev_dbg(db-dev, entering %s\n, __func__);
+   if (netif_msg_ifup(db))
+   dev_dbg(db-dev, enabling %s\n, dev-name);
 
if (db-platdata)
irqflags |= db-platdata-irqflags;
@@ -881,7 +882,8 @@ dm9000_stop(struct net_device *ndev)
 {
board_info_t *db = (board_info_t *) ndev-priv;
 
-   dm9000_dbg(db, 1, entering %s\n, __func__);
+   if (netif_msg_ifdown(db))
+   dev_dbg(db-dev, shutting down %s\n, ndev-name);
 
/* deleted timer */
kthread_stop(db-thread);
@@ -912,6 +914,9 @@ dm9000_tx_done(struct net_device *dev, b
db-tx_pkt_cnt--;
db-stats.tx_packets++;
 
+   if (netif_msg_tx_done(db))
+   dev_dbg(db-dev, tx done, NSR %02x\n, tx_status);
+
/* Queue packet check  send */
if (db-tx_pkt_cnt  0) {
iow(db, DM9000_TXPLL, db-queue_pkt_len  0xff);
@@ -947,6 +952,9 @@ dm9000_interrupt(int irq, void *dev_id)
int_status = ior(db, DM9000_ISR);   /* Got ISR */
iow(db, DM9000_ISR, int_status);/* Clear ISR status */
 
+   if (netif_msg_intr(db))
+   dev_dbg(db-dev, interrupt status %02x\n, int_status);
+
/* Received the coming packet */
if (int_status  ISR_PRS)
dm9000_rx(dev);
@@ -1048,10 +1056,15 @@ dm9000_rx(struct net_device *dev)
 
RxLen = le16_to_cpu(rxhdr.RxLen);
 
+   if (netif_msg_rx_status(db))
+   dev_dbg(db-dev, RX: status %02x, length %04x\n,
+   rxhdr.RxStatus, RxLen);
+
/* Packet Status check */
if (RxLen  0x40) {
GoodPacket = false;
-   dev_dbg(db-dev, Bad Packet received (runt)\n);
+   if (netif_msg_rx_err(db))
+   dev_dbg(db-dev, RX: Bad Packet (runt)\n);
}
 
if (RxLen  DM9000_PKT_MAX) {
@@ -1061,15 +1074,18 @@ dm9000_rx(struct net_device *dev)
if (rxhdr.RxStatus  0xbf) {
GoodPacket = false;
if (rxhdr.RxStatus  0x01) {
-   dev_dbg(db-dev, fifo error\n);
+   if (netif_msg_rx_err(db))
+   dev_dbg(db-dev, fifo error\n);
db-stats.rx_fifo_errors++;
}
if (rxhdr.RxStatus  0x02) {
-   dev_dbg(db-dev, crc error\n);
+   if (netif_msg_rx_err(db))
+   dev_dbg(db-dev, crc error\n);
db-stats.rx_crc_errors++;
}
if (rxhdr.RxStatus  0x80) {
-   dev_dbg(db-dev, length error\n);
+   if (netif_msg_rx_err(db))
+   dev_dbg(db-dev, length error\n);
db-stats.rx_length_errors++;
}
}

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html