drivers/net/jme: Use pr_<level>
authorJoe Perches <joe@perches.com>
Sat, 4 Sep 2010 22:21:05 +0000 (22:21 +0000)
committerGuo-Fu Tseng <cooldavid@cooldavid.org>
Mon, 18 Oct 2010 22:44:09 +0000 (06:44 +0800)
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert jeprintk to pr_err
Remove jeprintk macro define
Remove periods from end of logging messages
Coalesce format strings

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
jme.c
jme.h

diff --git a/jme.c b/jme.c
index be1809c..3b84cb3 100644 (file)
--- a/jme.c
+++ b/jme.c
  */
 
 #include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#endif
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -74,7 +78,7 @@ read_again:
        }
 
        if (i == 0) {
-               jeprintk(jme->pdev, "phy(%d) read timeout : %d\n", phy, reg);
+               pr_err("phy(%d) read timeout : %d\n", phy, reg);
                return 0;
        }
 
@@ -103,7 +107,7 @@ jme_mdio_write(struct net_device *netdev,
        }
 
        if (i == 0)
-               jeprintk(jme->pdev, "phy(%d) write timeout : %d\n", phy, reg);
+               pr_err("phy(%d) write timeout : %d\n", phy, reg);
 }
 
 static inline void
@@ -228,7 +232,7 @@ jme_reload_eeprom(struct jme_adapter *jme)
                }
 
                if (i == 0) {
-                       jeprintk(jme->pdev, "eeprom reload timeout\n");
+                       pr_err("eeprom reload timeout\n");
                        return -EIO;
                }
        }
@@ -286,11 +290,7 @@ jme_set_rx_pcc(struct jme_adapter *jme, int p)
        wmb();
 
        if (!(test_bit(JME_FLAG_POLL, &jme->flags)))
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_rx_status(jme, "Switched to PCC_P%d\n", p);
-#else
                netif_info(jme, rx_status, jme->dev, "Switched to PCC_P%d\n", p);
-#endif
 }
 
 static void
@@ -402,8 +402,7 @@ jme_check_link(struct net_device *netdev, int testonly)
                                        phylink = jread32(jme, JME_PHY_LINK);
                        }
                        if (!cnt)
-                               jeprintk(jme->pdev,
-                                       "Waiting speed resolve timeout.\n");
+                               pr_err("Waiting speed resolve timeout\n");
 
                        strcat(linkmsg, "ANed: ");
                }
@@ -485,21 +484,13 @@ jme_check_link(struct net_device *netdev, int testonly)
                strcat(linkmsg, (phylink & PHY_LINK_MDI_STAT) ?
                                        "MDI-X" :
                                        "MDI");
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_link(jme, "Link is up at %s.\n", linkmsg);
-#else
-               netif_info(jme, link, jme->dev, "Link is up at %s.\n", linkmsg);
-#endif
+               netif_info(jme, link, jme->dev, "Link is up at %s\n", linkmsg);
                netif_carrier_on(netdev);
        } else {
                if (testonly)
                        goto out;
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_link(jme, "Link is down.\n");
-#else
-               netif_info(jme, link, jme->dev, "Link is down.\n");
-#endif
+               netif_info(jme, link, jme->dev, "Link is down\n");
                jme->phylink = 0;
                netif_carrier_off(netdev);
        }
@@ -661,7 +652,7 @@ jme_disable_tx_engine(struct jme_adapter *jme)
        }
 
        if (!i)
-               jeprintk(jme->pdev, "Disable TX engine timeout.\n");
+               pr_err("Disable TX engine timeout\n");
 }
 
 static void
@@ -883,7 +874,7 @@ jme_disable_rx_engine(struct jme_adapter *jme)
        }
 
        if (!i)
-               jeprintk(jme->pdev, "Disable RX engine timeout.\n");
+               pr_err("Disable RX engine timeout\n");
 
 }
 
@@ -896,32 +887,20 @@ jme_rxsum_ok(struct jme_adapter *jme, u16 flags)
        if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_TCPON | RXWBFLAG_TCPCS))
                        == RXWBFLAG_TCPON)) {
                if (flags & RXWBFLAG_IPV4)
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-                       msg_rx_err(jme, "TCP Checksum error\n");
-#else
                        netif_err(jme, rx_err, jme->dev, "TCP Checksum error\n");
-#endif
                return false;
        }
 
        if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS))
                        == RXWBFLAG_UDPON)) {
                if (flags & RXWBFLAG_IPV4)
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-                       msg_rx_err(jme, "UDP Checksum error.\n");
-#else
-                       netif_err(jme, rx_err, jme->dev, "UDP Checksum error.\n");
-#endif
+                       netif_err(jme, rx_err, jme->dev, "UDP Checksum error\n");
                return false;
        }
 
        if (unlikely((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS))
                        == RXWBFLAG_IPV4)) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_rx_err(jme, "IPv4 Checksum error.\n");
-#else
-               netif_err(jme, rx_err, jme->dev, "IPv4 Checksum error.\n");
-#endif
+               netif_err(jme, rx_err, jme->dev, "IPv4 Checksum error\n");
                return false;
        }
 
@@ -1217,17 +1196,9 @@ jme_link_change_tasklet(unsigned long arg)
 
        while (!atomic_dec_and_test(&jme->link_changing)) {
                atomic_inc(&jme->link_changing);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_intr(jme, "Get link change lock failed.\n");
-#else
-               netif_info(jme, intr, jme->dev, "Get link change lock failed.\n");
-#endif
+               netif_info(jme, intr, jme->dev, "Get link change lock failed\n");
                while (atomic_read(&jme->link_changing) != 1)
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-                       msg_intr(jme, "Waiting link change lock.\n");
-#else
-                       netif_info(jme, intr, jme->dev, "Waiting link change lock.\n");
-#endif
+                       netif_info(jme, intr, jme->dev, "Waiting link change lock\n");
        }
 
        if (jme_check_link(netdev, 1) && jme->old_mtu == netdev->mtu)
@@ -1261,15 +1232,13 @@ jme_link_change_tasklet(unsigned long arg)
        if (netif_carrier_ok(netdev)) {
                rc = jme_setup_rx_resources(jme);
                if (rc) {
-                       jeprintk(jme->pdev, "Allocating resources for RX error"
-                               ", Device STOPPED!\n");
+                       pr_err("Allocating resources for RX error, Device STOPPED!\n");
                        goto out_enable_tasklet;
                }
 
                rc = jme_setup_tx_resources(jme);
                if (rc) {
-                       jeprintk(jme->pdev, "Allocating resources for TX error"
-                               ", Device STOPPED!\n");
+                       pr_err("Allocating resources for TX error, Device STOPPED!\n");
                        goto err_out_free_rx_resources;
                }
 
@@ -1345,11 +1314,7 @@ jme_rx_empty_tasklet(unsigned long arg)
        if (unlikely(!netif_carrier_ok(jme->dev)))
                return;
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-       msg_rx_status(jme, "RX Queue Full!\n");
-#else
        netif_info(jme, rx_status, jme->dev, "RX Queue Full!\n");
-#endif
 
        jme_rx_clean_tasklet(arg);
 
@@ -1369,11 +1334,7 @@ jme_wake_queue_if_stopped(struct jme_adapter *jme)
        smp_wmb();
        if (unlikely(netif_queue_stopped(jme->dev) &&
        atomic_read(&txring->nr_free) >= (jme->tx_wake_threshold))) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_tx_done(jme, "TX Queue Waked.\n");
-#else
-               netif_info(jme, tx_done, jme->dev, "TX Queue Waked.\n");
-#endif
+               netif_info(jme, tx_done, jme->dev, "TX Queue Waked\n");
                netif_wake_queue(jme->dev);
        }
 
@@ -1388,7 +1349,7 @@ jme_tx_clean_tasklet(unsigned long arg)
        struct jme_buffer_info *txbi = txring->bufinf, *ctxbi, *ttxbi;
        int i, j, cnt = 0, max, err, mask;
 
-       tx_dbg(jme, "Into txclean.\n");
+       tx_dbg(jme, "Into txclean\n");
 
        if (unlikely(!atomic_dec_and_test(&jme->tx_cleaning)))
                goto out;
@@ -1410,7 +1371,7 @@ jme_tx_clean_tasklet(unsigned long arg)
                !(txdesc[i].descwb.flags & TXWBFLAG_OWN))) {
 
                        tx_dbg(jme, "txclean: %d+%d@%lu\n",
-                                       i, ctxbi->nr_desc, jiffies);
+                              i, ctxbi->nr_desc, jiffies);
 
                        err = txdesc[i].descwb.flags & TXWBFLAG_ALLERR;
 
@@ -1451,7 +1412,7 @@ jme_tx_clean_tasklet(unsigned long arg)
                ctxbi->nr_desc = 0;
        }
 
-       tx_dbg(jme, "txclean: done %d@%lu.\n", i, jiffies);
+       tx_dbg(jme, "txclean: done %d@%lu\n", i, jiffies);
        atomic_set(&txring->next_to_clean, i);
        atomic_add(cnt, &txring->nr_free);
 
@@ -1612,10 +1573,10 @@ jme_request_irq(struct jme_adapter *jme)
        rc = request_irq(jme->pdev->irq, handler, irq_flags, netdev->name,
                          netdev);
        if (rc) {
-               jeprintk(jme->pdev,
-                       "Unable to request %s interrupt (return: %d)\n",
-                       test_bit(JME_FLAG_MSI, &jme->flags) ? "MSI" : "INTx",
-                       rc);
+               netdev_err(netdev,
+                          "Unable to request %s interrupt (return: %d)\n",
+                          test_bit(JME_FLAG_MSI, &jme->flags) ? "MSI" : "INTx",
+                          rc);
 
                if (test_bit(JME_FLAG_MSI, &jme->flags)) {
                        pci_disable_msi(jme->pdev);
@@ -1921,11 +1882,7 @@ jme_tx_csum(struct jme_adapter *jme, struct sk_buff *skb, u8 *flags)
                        *flags |= TXFLAG_UDPCS;
                        break;
                default:
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-                       msg_tx_err(jme, "Error upper layer protocol.\n");
-#else
-                       netif_err(jme, tx_err, jme->dev, "Error upper layer protocol.\n");
-#endif
+                       netif_err(jme, tx_err, jme->dev, "Error upper layer protocol\n");
                        break;
                }
        }
@@ -2000,20 +1957,12 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
        smp_wmb();
        if (unlikely(atomic_read(&txring->nr_free) < (MAX_SKB_FRAGS+2))) {
                netif_stop_queue(jme->dev);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_tx_queued(jme, "TX Queue Paused.\n");
-#else
-               netif_info(jme, tx_queued, jme->dev, "TX Queue Paused.\n");
-#endif
+               netif_info(jme, tx_queued, jme->dev, "TX Queue Paused\n");
                smp_wmb();
                if (atomic_read(&txring->nr_free)
                        >= (jme->tx_wake_threshold)) {
                        netif_wake_queue(jme->dev);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-                       msg_tx_queued(jme, "TX Queue Fast Waked.\n");
-#else
-                       netif_info(jme, tx_queued, jme->dev, "TX Queue Fast Waked.\n");
-#endif
+                       netif_info(jme, tx_queued, jme->dev, "TX Queue Fast Waked\n");
                }
        }
 
@@ -2021,11 +1970,7 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
                        (jiffies - txbi->start_xmit) >= TX_TIMEOUT &&
                        txbi->skb)) {
                netif_stop_queue(jme->dev);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_tx_queued(jme, "TX Queue Stopped %d@%lu.\n", idx, jiffies);
-#else
-               netif_info(jme, tx_queued, jme->dev, "TX Queue Stopped %d@%lu.\n", idx, jiffies);
-#endif
+               netif_info(jme, tx_queued, jme->dev, "TX Queue Stopped %d@%lu\n", idx, jiffies);
        }
 }
 
@@ -2052,11 +1997,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 
        if (unlikely(idx < 0)) {
                netif_stop_queue(netdev);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_tx_err(jme, "BUG! Tx ring full when queue awake!\n");
-#else
-               netif_err(jme, tx_err, jme->dev, "BUG! Tx ring full when queue awake!\n");
-#endif
+               netif_err(jme, tx_err, jme->dev,
+                         "BUG! Tx ring full when queue awake!\n");
 
                return NETDEV_TX_BUSY;
        }
@@ -2071,9 +2013,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
        netdev->trans_start = jiffies;
 #endif
 
-       tx_dbg(jme, "xmit: %d+%d@%lu\n", idx,
-                       skb_shinfo(skb)->nr_frags + 2,
-                       jiffies);
+       tx_dbg(jme, "xmit: %d+%d@%lu\n",
+              idx, skb_shinfo(skb)->nr_frags + 2, jiffies);
        jme_stop_queue_if_full(jme);
 
        return NETDEV_TX_OK;
@@ -2667,11 +2608,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
                val = jread32(jme, JME_SMBCSR);
        }
        if (!to) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_hw(jme, "SMB Bus Busy.\n");
-#else
-               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
-#endif
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
                return 0xFF;
        }
 
@@ -2687,11 +2624,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
                val = jread32(jme, JME_SMBINTF);
        }
        if (!to) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_hw(jme, "SMB Bus Busy.\n");
-#else
-               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
-#endif
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
                return 0xFF;
        }
 
@@ -2711,11 +2644,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
                val = jread32(jme, JME_SMBCSR);
        }
        if (!to) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_hw(jme, "SMB Bus Busy.\n");
-#else
-               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
-#endif
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
                return;
        }
 
@@ -2732,11 +2661,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
                val = jread32(jme, JME_SMBINTF);
        }
        if (!to) {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-               msg_hw(jme, "SMB Bus Busy.\n");
-#else
-               netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n");
-#endif
+               netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
                return;
        }
 
@@ -2910,26 +2835,26 @@ jme_init_one(struct pci_dev *pdev,
         */
        rc = pci_enable_device(pdev);
        if (rc) {
-               jeprintk(pdev, "Cannot enable PCI device.\n");
+               pr_err("Cannot enable PCI device\n");
                goto err_out;
        }
 
        using_dac = jme_pci_dma64(pdev);
        if (using_dac < 0) {
-               jeprintk(pdev, "Cannot set PCI DMA Mask.\n");
+               pr_err("Cannot set PCI DMA Mask\n");
                rc = -EIO;
                goto err_out_disable_pdev;
        }
 
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
-               jeprintk(pdev, "No PCI resource region found.\n");
+               pr_err("No PCI resource region found\n");
                rc = -ENOMEM;
                goto err_out_disable_pdev;
        }
 
        rc = pci_request_regions(pdev, DRV_NAME);
        if (rc) {
-               jeprintk(pdev, "Cannot obtain PCI resource region.\n");
+               pr_err("Cannot obtain PCI resource region\n");
                goto err_out_disable_pdev;
        }
 
@@ -2940,7 +2865,7 @@ jme_init_one(struct pci_dev *pdev,
         */
        netdev = alloc_etherdev(sizeof(*jme));
        if (!netdev) {
-               jeprintk(pdev, "Cannot allocate netdev structure.\n");
+               pr_err("Cannot allocate netdev structure\n");
                rc = -ENOMEM;
                goto err_out_release_regions;
        }
@@ -2995,7 +2920,7 @@ jme_init_one(struct pci_dev *pdev,
        jme->regs = ioremap(pci_resource_start(pdev, 0),
                             pci_resource_len(pdev, 0));
        if (!(jme->regs)) {
-               jeprintk(pdev, "Mapping PCI resource region error.\n");
+               pr_err("Mapping PCI resource region error\n");
                rc = -ENOMEM;
                goto err_out_free_netdev;
        }
@@ -3083,8 +3008,8 @@ jme_init_one(struct pci_dev *pdev,
 
                if (!jme->mii_if.phy_id) {
                        rc = -EIO;
-                       jeprintk(pdev, "Can not find phy_id.\n");
-                        goto err_out_unmap;
+                       pr_err("Can not find phy_id\n");
+                       goto err_out_unmap;
                }
 
                jme->reg_ghc |= GHC_LINK_POLL;
@@ -3111,8 +3036,7 @@ jme_init_one(struct pci_dev *pdev,
        jme_reset_mac_processor(jme);
        rc = jme_reload_eeprom(jme);
        if (rc) {
-               jeprintk(pdev,
-                       "Reload eeprom for reading MAC Address error.\n");
+               pr_err("Reload eeprom for reading MAC Address error\n");
                goto err_out_unmap;
        }
        jme_load_macaddr(netdev);
@@ -3128,36 +3052,25 @@ jme_init_one(struct pci_dev *pdev,
         */
        rc = register_netdev(netdev);
        if (rc) {
-               jeprintk(pdev, "Cannot register net device.\n");
+               pr_err("Cannot register net device\n");
                goto err_out_unmap;
        }
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
-       msg_probe(jme, "%s%s ver:%x rev:%x "
-                       "macaddr: %02x:%02x:%02x:%02x:%02x:%02x\n",
-               (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC250) ?
-                       "JMC250 Gigabit Ethernet" :
-                       (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC260) ?
-                               "JMC260 Fast Ethernet" : "Unknown",
-               (jme->fpgaver != 0) ? " (FPGA)" : "",
-               (jme->fpgaver != 0) ? jme->fpgaver : jme->chiprev,
-               jme->rev,
-               netdev->dev_addr[0],
-               netdev->dev_addr[1],
-               netdev->dev_addr[2],
-               netdev->dev_addr[3],
-               netdev->dev_addr[4],
-               netdev->dev_addr[5]);
-#else
-       netif_info(jme, probe, jme->dev, "%s%s ver:%x rev:%x macaddr:%pM\n",
+       netif_info(jme, probe, jme->dev, "%s%s ver:%x rev:%x "
+                  "macaddr: %02x:%02x:%02x:%02x:%02x:%02x\n",
                   (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC250) ?
                   "JMC250 Gigabit Ethernet" :
                   (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC260) ?
                   "JMC260 Fast Ethernet" : "Unknown",
                   (jme->fpgaver != 0) ? " (FPGA)" : "",
                   (jme->fpgaver != 0) ? jme->fpgaver : jme->chiprev,
-                  jme->rev, netdev->dev_addr);
-#endif
+                  jme->rev,
+                  netdev->dev_addr[0],
+                  netdev->dev_addr[1],
+                  netdev->dev_addr[2],
+                  netdev->dev_addr[3],
+                  netdev->dev_addr[4],
+                  netdev->dev_addr[5]);
 
        return 0;
 
@@ -3292,8 +3205,7 @@ static struct pci_driver jme_driver = {
 static int __init
 jme_init_module(void)
 {
-       printk(KERN_INFO PFX "JMicron JMC2XX ethernet "
-              "driver version %s\n", DRV_VERSION);
+       pr_info("JMicron JMC2XX ethernet driver version %s\n", DRV_VERSION);
        return pci_register_driver(&jme_driver);
 }
 
diff --git a/jme.h b/jme.h
index ee0177d..0075f26 100644 (file)
--- a/jme.h
+++ b/jme.h
        NETIF_MSG_TX_ERR | \
        NETIF_MSG_HW)
 
-#define jeprintk(pdev, fmt, args...) \
-       printk(KERN_ERR PFX fmt, ## args)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
+#define pr_err(fmt, arg...) \
+       printk(KERN_ERR fmt, ##arg)
+#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33)
+#define netdev_err(netdev, fmt, arg...) \
+       pr_err(fmt, ##arg)
+#endif
 
 #ifdef TX_DEBUG
 #define tx_dbg(priv, fmt, args...)                                     \
@@ -86,6 +92,11 @@ do {                                                                 \
 
 #define msg_hw(priv, fmt, args...) \
        jme_msg(KERN_ERR, hw, priv, fmt, ## args)
+
+#define netif_info(priv, type, dev, fmt, args...) \
+       msg_ ## type(priv, fmt, ## args)
+#define netif_err(priv, type, dev, fmt, args...) \
+       msg_ ## type(priv, fmt, ## args)
 #endif
 
 /*