diff options
author | Joe Perches <joe@perches.com> | 2010-02-27 14:43:51 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-16 21:23:25 -0700 |
commit | 0dc7d2b3cbfcf4ff20bdc68f563a2e52e6a2178f (patch) | |
tree | 9f81abd6d5d494230a4d23b1a27f399f5832f9e7 /drivers/net/ks8851.c | |
parent | ca50910185fcce694af0cc194de50d2374a7c7ef (diff) | |
download | linux-3.10-0dc7d2b3cbfcf4ff20bdc68f563a2e52e6a2178f.tar.gz linux-3.10-0dc7d2b3cbfcf4ff20bdc68f563a2e52e6a2178f.tar.bz2 linux-3.10-0dc7d2b3cbfcf4ff20bdc68f563a2e52e6a2178f.zip |
drivers/net/ks*: Use netdev_<level>, netif_<level> and pr_<level>
I'm not sure this is correct.
It changes logging macros from:
dev_<level>(&ks->spidev->dev,
to
netdev_<level>(ks->netdev,
Comments?
Use netdev_<level>
Use netif_<level>
Use pr_<level>
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Add missing line to message in ks8851_remove
Change kmalloc/memset(,0) to kzalloc
Remove ks_<level> macros
Consolidation code into set_media_state
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ks8851.c')
-rw-r--r-- | drivers/net/ks8851.c | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c index 0573e0bb444..6f414824caf 100644 --- a/drivers/net/ks8851.c +++ b/drivers/net/ks8851.c @@ -9,6 +9,8 @@ * published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #define DEBUG #include <linux/module.h> @@ -125,11 +127,6 @@ struct ks8851_net { static int msg_enable; -#define ks_info(_ks, _msg...) dev_info(&(_ks)->spidev->dev, _msg) -#define ks_warn(_ks, _msg...) dev_warn(&(_ks)->spidev->dev, _msg) -#define ks_dbg(_ks, _msg...) dev_dbg(&(_ks)->spidev->dev, _msg) -#define ks_err(_ks, _msg...) dev_err(&(_ks)->spidev->dev, _msg) - /* shift for byte-enable data */ #define BYTE_EN(_x) ((_x) << 2) @@ -167,7 +164,7 @@ static void ks8851_wrreg16(struct ks8851_net *ks, unsigned reg, unsigned val) ret = spi_sync(ks->spidev, msg); if (ret < 0) - ks_err(ks, "spi_sync() failed\n"); + netdev_err(ks->netdev, "spi_sync() failed\n"); } /** @@ -197,7 +194,7 @@ static void ks8851_wrreg8(struct ks8851_net *ks, unsigned reg, unsigned val) ret = spi_sync(ks->spidev, msg); if (ret < 0) - ks_err(ks, "spi_sync() failed\n"); + netdev_err(ks->netdev, "spi_sync() failed\n"); } /** @@ -263,7 +260,7 @@ static void ks8851_rdreg(struct ks8851_net *ks, unsigned op, ret = spi_sync(ks->spidev, msg); if (ret < 0) - ks_err(ks, "read: spi_sync() failed\n"); + netdev_err(ks->netdev, "read: spi_sync() failed\n"); else if (ks8851_rx_1msg(ks)) memcpy(rxb, trx + 2, rxl); else @@ -417,8 +414,8 @@ static void ks8851_rdfifo(struct ks8851_net *ks, u8 *buff, unsigned len) u8 txb[1]; int ret; - if (netif_msg_rx_status(ks)) - ks_dbg(ks, "%s: %d@%p\n", __func__, len, buff); + netif_dbg(ks, rx_status, ks->netdev, + "%s: %d@%p\n", __func__, len, buff); /* set the operation we're issuing */ txb[0] = KS_SPIOP_RXFIFO; @@ -434,7 +431,7 @@ static void ks8851_rdfifo(struct ks8851_net *ks, u8 *buff, unsigned len) ret = spi_sync(ks->spidev, msg); if (ret < 0) - ks_err(ks, "%s: spi_sync() failed\n", __func__); + netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); } /** @@ -446,10 +443,11 @@ static void ks8851_rdfifo(struct ks8851_net *ks, u8 *buff, unsigned len) */ static void ks8851_dbg_dumpkkt(struct ks8851_net *ks, u8 *rxpkt) { - ks_dbg(ks, "pkt %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n", - rxpkt[4], rxpkt[5], rxpkt[6], rxpkt[7], - rxpkt[8], rxpkt[9], rxpkt[10], rxpkt[11], - rxpkt[12], rxpkt[13], rxpkt[14], rxpkt[15]); + netdev_dbg(ks->netdev, + "pkt %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n", + rxpkt[4], rxpkt[5], rxpkt[6], rxpkt[7], + rxpkt[8], rxpkt[9], rxpkt[10], rxpkt[11], + rxpkt[12], rxpkt[13], rxpkt[14], rxpkt[15]); } /** @@ -471,8 +469,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) rxfc = ks8851_rdreg8(ks, KS_RXFC); - if (netif_msg_rx_status(ks)) - ks_dbg(ks, "%s: %d packets\n", __func__, rxfc); + netif_dbg(ks, rx_status, ks->netdev, + "%s: %d packets\n", __func__, rxfc); /* Currently we're issuing a read per packet, but we could possibly * improve the code by issuing a single read, getting the receive @@ -489,9 +487,8 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) rxstat = rxh & 0xffff; rxlen = rxh >> 16; - if (netif_msg_rx_status(ks)) - ks_dbg(ks, "rx: stat 0x%04x, len 0x%04x\n", - rxstat, rxlen); + netif_dbg(ks, rx_status, ks->netdev, + "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); /* the length of the packet includes the 32bit CRC */ @@ -553,9 +550,8 @@ static void ks8851_irq_work(struct work_struct *work) status = ks8851_rdreg16(ks, KS_ISR); - if (netif_msg_intr(ks)) - dev_dbg(&ks->spidev->dev, "%s: status 0x%04x\n", - __func__, status); + netif_dbg(ks, intr, ks->netdev, + "%s: status 0x%04x\n", __func__, status); if (status & IRQ_LCI) { /* should do something about checking link status */ @@ -582,8 +578,8 @@ static void ks8851_irq_work(struct work_struct *work) * system */ ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR); - if (netif_msg_intr(ks)) - ks_dbg(ks, "%s: txspace %d\n", __func__, ks->tx_space); + netif_dbg(ks, intr, ks->netdev, + "%s: txspace %d\n", __func__, ks->tx_space); } if (status & IRQ_RXI) @@ -659,9 +655,8 @@ static void ks8851_wrpkt(struct ks8851_net *ks, struct sk_buff *txp, bool irq) unsigned fid = 0; int ret; - if (netif_msg_tx_queued(ks)) - dev_dbg(&ks->spidev->dev, "%s: skb %p, %d@%p, irq %d\n", - __func__, txp, txp->len, txp->data, irq); + netif_dbg(ks, tx_queued, ks->netdev, "%s: skb %p, %d@%p, irq %d\n", + __func__, txp, txp->len, txp->data, irq); fid = ks->fid++; fid &= TXFR_TXFID_MASK; @@ -685,7 +680,7 @@ static void ks8851_wrpkt(struct ks8851_net *ks, struct sk_buff *txp, bool irq) ret = spi_sync(ks->spidev, msg); if (ret < 0) - ks_err(ks, "%s: spi_sync() failed\n", __func__); + netdev_err(ks->netdev, "%s: spi_sync() failed\n", __func__); } /** @@ -744,8 +739,7 @@ static void ks8851_set_powermode(struct ks8851_net *ks, unsigned pwrmode) { unsigned pmecr; - if (netif_msg_hw(ks)) - ks_dbg(ks, "setting power mode %d\n", pwrmode); + netif_dbg(ks, hw, ks->netdev, "setting power mode %d\n", pwrmode); pmecr = ks8851_rdreg16(ks, KS_PMECR); pmecr &= ~PMECR_PM_MASK; @@ -769,8 +763,7 @@ static int ks8851_net_open(struct net_device *dev) * else at the moment */ mutex_lock(&ks->lock); - if (netif_msg_ifup(ks)) - ks_dbg(ks, "opening %s\n", dev->name); + netif_dbg(ks, ifup, ks->netdev, "opening\n"); /* bring chip out of any power saving mode it was in */ ks8851_set_powermode(ks, PMECR_PM_NORMAL); @@ -826,8 +819,7 @@ static int ks8851_net_open(struct net_device *dev) netif_start_queue(ks->netdev); - if (netif_msg_ifup(ks)) - ks_dbg(ks, "network device %s up\n", dev->name); + netif_dbg(ks, ifup, ks->netdev, "network device up\n"); mutex_unlock(&ks->lock); return 0; @@ -845,8 +837,7 @@ static int ks8851_net_stop(struct net_device *dev) { struct ks8851_net *ks = netdev_priv(dev); - if (netif_msg_ifdown(ks)) - ks_info(ks, "%s: shutting down\n", dev->name); + netif_info(ks, ifdown, dev, "shutting down\n"); netif_stop_queue(dev); @@ -874,8 +865,8 @@ static int ks8851_net_stop(struct net_device *dev) while (!skb_queue_empty(&ks->txq)) { struct sk_buff *txb = skb_dequeue(&ks->txq); - if (netif_msg_ifdown(ks)) - ks_dbg(ks, "%s: freeing txb %p\n", __func__, txb); + netif_dbg(ks, ifdown, ks->netdev, + "%s: freeing txb %p\n", __func__, txb); dev_kfree_skb(txb); } @@ -904,9 +895,8 @@ static netdev_tx_t ks8851_start_xmit(struct sk_buff *skb, unsigned needed = calc_txlen(skb->len); netdev_tx_t ret = NETDEV_TX_OK; - if (netif_msg_tx_queued(ks)) - ks_dbg(ks, "%s: skb %p, %d@%p\n", __func__, - skb, skb->len, skb->data); + netif_dbg(ks, tx_queued, ks->netdev, + "%s: skb %p, %d@%p\n", __func__, skb, skb->len, skb->data); spin_lock(&ks->statelock); @@ -1186,17 +1176,17 @@ static int ks8851_read_selftest(struct ks8851_net *ks) rd = ks8851_rdreg16(ks, KS_MBIR); if ((rd & both_done) != both_done) { - ks_warn(ks, "Memory selftest not finished\n"); + netdev_warn(ks->netdev, "Memory selftest not finished\n"); return 0; } if (rd & MBIR_TXMBFA) { - ks_err(ks, "TX memory selftest fail\n"); + netdev_err(ks->netdev, "TX memory selftest fail\n"); ret |= 1; } if (rd & MBIR_RXMBFA) { - ks_err(ks, "RX memory selftest fail\n"); + netdev_err(ks->netdev, "RX memory selftest fail\n"); ret |= 2; } @@ -1294,9 +1284,9 @@ static int __devinit ks8851_probe(struct spi_device *spi) goto err_netdev; } - dev_info(&spi->dev, "revision %d, MAC %pM, IRQ %d\n", - CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), - ndev->dev_addr, ndev->irq); + netdev_info(ndev, "revision %d, MAC %pM, IRQ %d\n", + CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), + ndev->dev_addr, ndev->irq); return 0; @@ -1315,7 +1305,7 @@ static int __devexit ks8851_remove(struct spi_device *spi) struct ks8851_net *priv = dev_get_drvdata(&spi->dev); if (netif_msg_drv(priv)) - dev_info(&spi->dev, "remove"); + dev_info(&spi->dev, "remove\n"); unregister_netdev(priv->netdev); free_irq(spi->irq, priv); |