Commit ad06ab2a authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/sis190.c: Use (pr|netdev|netif)_<level> macro helpers

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove #define PFX
Use pr_<level>
Use netdev_<level>
Use netif_<level> and netif_msg_<test>
Remove local #define net_<test> macros
Remove periods from formats
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05dbe005
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
See the file COPYING in this distribution for more information. See the file COPYING in this distribution for more information.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
...@@ -32,17 +34,6 @@ ...@@ -32,17 +34,6 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <asm/irq.h> #include <asm/irq.h>
#define net_drv(p, arg...) if (netif_msg_drv(p)) \
printk(arg)
#define net_probe(p, arg...) if (netif_msg_probe(p)) \
printk(arg)
#define net_link(p, arg...) if (netif_msg_link(p)) \
printk(arg)
#define net_intr(p, arg...) if (netif_msg_intr(p)) \
printk(arg)
#define net_tx_err(p, arg...) if (netif_msg_tx_err(p)) \
printk(arg)
#define PHY_MAX_ADDR 32 #define PHY_MAX_ADDR 32
#define PHY_ID_ANY 0x1f #define PHY_ID_ANY 0x1f
#define MII_REG_ANY 0x1f #define MII_REG_ANY 0x1f
...@@ -50,7 +41,6 @@ ...@@ -50,7 +41,6 @@
#define DRV_VERSION "1.4" #define DRV_VERSION "1.4"
#define DRV_NAME "sis190" #define DRV_NAME "sis190"
#define SIS190_DRIVER_NAME DRV_NAME " Gigabit Ethernet driver " DRV_VERSION #define SIS190_DRIVER_NAME DRV_NAME " Gigabit Ethernet driver " DRV_VERSION
#define PFX DRV_NAME ": "
#define sis190_rx_skb netif_rx #define sis190_rx_skb netif_rx
#define sis190_rx_quota(count, quota) count #define sis190_rx_quota(count, quota) count
...@@ -382,7 +372,7 @@ static void __mdio_cmd(void __iomem *ioaddr, u32 ctl) ...@@ -382,7 +372,7 @@ static void __mdio_cmd(void __iomem *ioaddr, u32 ctl)
} }
if (i > 99) if (i > 99)
printk(KERN_ERR PFX "PHY command failed !\n"); pr_err("PHY command failed !\n");
} }
static void mdio_write(void __iomem *ioaddr, int phy_id, int reg, int val) static void mdio_write(void __iomem *ioaddr, int phy_id, int reg, int val)
...@@ -590,8 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev, ...@@ -590,8 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
status = le32_to_cpu(desc->PSize); status = le32_to_cpu(desc->PSize);
// net_intr(tp, KERN_INFO "%s: Rx PSize = %08x.\n", dev->name, //netif_info(tp, intr, dev, "Rx PSize = %08x\n", status);
// status);
if (sis190_rx_pkt_err(status, stats) < 0) if (sis190_rx_pkt_err(status, stats) < 0)
sis190_give_to_asic(desc, tp->rx_buf_sz); sis190_give_to_asic(desc, tp->rx_buf_sz);
...@@ -602,9 +591,8 @@ static int sis190_rx_interrupt(struct net_device *dev, ...@@ -602,9 +591,8 @@ static int sis190_rx_interrupt(struct net_device *dev,
struct pci_dev *pdev = tp->pci_dev; struct pci_dev *pdev = tp->pci_dev;
if (unlikely(pkt_size > tp->rx_buf_sz)) { if (unlikely(pkt_size > tp->rx_buf_sz)) {
net_intr(tp, KERN_INFO netif_info(tp, intr, dev,
"%s: (frag) status = %08x.\n", "(frag) status = %08x\n", status);
dev->name, status);
stats->rx_dropped++; stats->rx_dropped++;
stats->rx_length_errors++; stats->rx_length_errors++;
sis190_give_to_asic(desc, tp->rx_buf_sz); sis190_give_to_asic(desc, tp->rx_buf_sz);
...@@ -638,12 +626,12 @@ static int sis190_rx_interrupt(struct net_device *dev, ...@@ -638,12 +626,12 @@ static int sis190_rx_interrupt(struct net_device *dev,
tp->cur_rx = cur_rx; tp->cur_rx = cur_rx;
delta = sis190_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); delta = sis190_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx);
if (!delta && count && netif_msg_intr(tp)) if (!delta && count)
printk(KERN_INFO "%s: no Rx buffer allocated.\n", dev->name); netif_info(tp, intr, dev, "no Rx buffer allocated\n");
tp->dirty_rx += delta; tp->dirty_rx += delta;
if (((tp->dirty_rx + NUM_RX_DESC) == tp->cur_rx) && netif_msg_intr(tp)) if ((tp->dirty_rx + NUM_RX_DESC) == tp->cur_rx)
printk(KERN_EMERG "%s: Rx buffers exhausted.\n", dev->name); netif_emerg(tp, intr, dev, "Rx buffers exhausted\n");
return count; return count;
} }
...@@ -752,10 +740,10 @@ static irqreturn_t sis190_interrupt(int irq, void *__dev) ...@@ -752,10 +740,10 @@ static irqreturn_t sis190_interrupt(int irq, void *__dev)
SIS_W32(IntrStatus, status); SIS_W32(IntrStatus, status);
// net_intr(tp, KERN_INFO "%s: status = %08x.\n", dev->name, status); // netif_info(tp, intr, dev, "status = %08x\n", status);
if (status & LinkChange) { if (status & LinkChange) {
net_intr(tp, KERN_INFO "%s: link change.\n", dev->name); netif_info(tp, intr, dev, "link change\n");
schedule_work(&tp->phy_task); schedule_work(&tp->phy_task);
} }
...@@ -931,8 +919,7 @@ static void sis190_phy_task(struct work_struct *work) ...@@ -931,8 +919,7 @@ static void sis190_phy_task(struct work_struct *work)
} else if (!(mdio_read_latched(ioaddr, phy_id, MII_BMSR) & } else if (!(mdio_read_latched(ioaddr, phy_id, MII_BMSR) &
BMSR_ANEGCOMPLETE)) { BMSR_ANEGCOMPLETE)) {
netif_carrier_off(dev); netif_carrier_off(dev);
net_link(tp, KERN_WARNING "%s: auto-negotiating...\n", netif_warn(tp, link, dev, "auto-negotiating...\n");
dev->name);
mod_timer(&tp->timer, jiffies + SIS190_PHY_TIMEOUT); mod_timer(&tp->timer, jiffies + SIS190_PHY_TIMEOUT);
} else { } else {
/* Rejoice ! */ /* Rejoice ! */
...@@ -958,13 +945,13 @@ static void sis190_phy_task(struct work_struct *work) ...@@ -958,13 +945,13 @@ static void sis190_phy_task(struct work_struct *work)
u16 adv, autoexp, gigadv, gigrec; u16 adv, autoexp, gigadv, gigrec;
val = mdio_read(ioaddr, phy_id, 0x1f); val = mdio_read(ioaddr, phy_id, 0x1f);
net_link(tp, KERN_INFO "%s: mii ext = %04x.\n", dev->name, val); netif_info(tp, link, dev, "mii ext = %04x\n", val);
val = mdio_read(ioaddr, phy_id, MII_LPA); val = mdio_read(ioaddr, phy_id, MII_LPA);
adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE); adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE);
autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION); autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION);
net_link(tp, KERN_INFO "%s: mii lpa=%04x adv=%04x exp=%04x.\n", netif_info(tp, link, dev, "mii lpa=%04x adv=%04x exp=%04x\n",
dev->name, val, adv, autoexp); val, adv, autoexp);
if (val & LPA_NPAGE && autoexp & EXPANSION_NWAY) { if (val & LPA_NPAGE && autoexp & EXPANSION_NWAY) {
/* check for gigabit speed */ /* check for gigabit speed */
...@@ -1005,8 +992,7 @@ static void sis190_phy_task(struct work_struct *work) ...@@ -1005,8 +992,7 @@ static void sis190_phy_task(struct work_struct *work)
tp->negotiated_lpa = p->val; tp->negotiated_lpa = p->val;
net_link(tp, KERN_INFO "%s: link on %s mode.\n", dev->name, netif_info(tp, link, dev, "link on %s mode\n", p->msg);
p->msg);
netif_carrier_on(dev); netif_carrier_on(dev);
} }
...@@ -1192,9 +1178,8 @@ static netdev_tx_t sis190_start_xmit(struct sk_buff *skb, ...@@ -1192,9 +1178,8 @@ static netdev_tx_t sis190_start_xmit(struct sk_buff *skb,
if (unlikely(le32_to_cpu(desc->status) & OWNbit)) { if (unlikely(le32_to_cpu(desc->status) & OWNbit)) {
netif_stop_queue(dev); netif_stop_queue(dev);
net_tx_err(tp, KERN_ERR PFX netif_err(tp, tx_err, dev,
"%s: BUG! Tx Ring full when queue awake!\n", "BUG! Tx Ring full when queue awake!\n");
dev->name);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -1294,8 +1279,8 @@ static u16 sis190_default_phy(struct net_device *dev) ...@@ -1294,8 +1279,8 @@ static u16 sis190_default_phy(struct net_device *dev)
if (mii_if->phy_id != phy_default->phy_id) { if (mii_if->phy_id != phy_default->phy_id) {
mii_if->phy_id = phy_default->phy_id; mii_if->phy_id = phy_default->phy_id;
net_probe(tp, KERN_INFO if (netif_msg_probe(tp))
"%s: Using transceiver at address %d as default.\n", pr_info("%s: Using transceiver at address %d as default\n",
pci_name(tp->pci_dev), mii_if->phy_id); pci_name(tp->pci_dev), mii_if->phy_id);
} }
...@@ -1334,12 +1319,13 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, ...@@ -1334,12 +1319,13 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp,
((mii_status & (BMSR_100FULL | BMSR_100HALF)) ? ((mii_status & (BMSR_100FULL | BMSR_100HALF)) ?
LAN : HOME) : p->type; LAN : HOME) : p->type;
tp->features |= p->feature; tp->features |= p->feature;
net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n", if (netif_msg_probe(tp))
pr_info("%s: %s transceiver at address %d\n",
pci_name(tp->pci_dev), p->name, phy_id); pci_name(tp->pci_dev), p->name, phy_id);
} else { } else {
phy->type = UNKNOWN; phy->type = UNKNOWN;
net_probe(tp, KERN_INFO if (netif_msg_probe(tp))
"%s: unknown PHY 0x%x:0x%x transceiver at address %d\n", pr_info("%s: unknown PHY 0x%x:0x%x transceiver at address %d\n",
pci_name(tp->pci_dev), pci_name(tp->pci_dev),
phy->id[0], (phy->id[1] & 0xfff0), phy_id); phy->id[0], (phy->id[1] & 0xfff0), phy_id);
} }
...@@ -1405,7 +1391,8 @@ static int __devinit sis190_mii_probe(struct net_device *dev) ...@@ -1405,7 +1391,8 @@ static int __devinit sis190_mii_probe(struct net_device *dev)
} }
if (list_empty(&tp->first_phy)) { if (list_empty(&tp->first_phy)) {
net_probe(tp, KERN_INFO "%s: No MII transceivers found!\n", if (netif_msg_probe(tp))
pr_info("%s: No MII transceivers found!\n",
pci_name(tp->pci_dev)); pci_name(tp->pci_dev));
rc = -EIO; rc = -EIO;
goto out; goto out;
...@@ -1452,7 +1439,8 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) ...@@ -1452,7 +1439,8 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev)
dev = alloc_etherdev(sizeof(*tp)); dev = alloc_etherdev(sizeof(*tp));
if (!dev) { if (!dev) {
net_drv(&debug, KERN_ERR PFX "unable to alloc new ethernet\n"); if (netif_msg_drv(&debug))
pr_err("unable to alloc new ethernet\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_0; goto err_out_0;
} }
...@@ -1465,33 +1453,38 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) ...@@ -1465,33 +1453,38 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev)
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc < 0) { if (rc < 0) {
net_probe(tp, KERN_ERR "%s: enable failure\n", pci_name(pdev)); if (netif_msg_probe(tp))
pr_err("%s: enable failure\n", pci_name(pdev));
goto err_free_dev_1; goto err_free_dev_1;
} }
rc = -ENODEV; rc = -ENODEV;
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
net_probe(tp, KERN_ERR "%s: region #0 is no MMIO resource.\n", if (netif_msg_probe(tp))
pr_err("%s: region #0 is no MMIO resource\n",
pci_name(pdev)); pci_name(pdev));
goto err_pci_disable_2; goto err_pci_disable_2;
} }
if (pci_resource_len(pdev, 0) < SIS190_REGS_SIZE) { if (pci_resource_len(pdev, 0) < SIS190_REGS_SIZE) {
net_probe(tp, KERN_ERR "%s: invalid PCI region size(s).\n", if (netif_msg_probe(tp))
pr_err("%s: invalid PCI region size(s)\n",
pci_name(pdev)); pci_name(pdev));
goto err_pci_disable_2; goto err_pci_disable_2;
} }
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc < 0) { if (rc < 0) {
net_probe(tp, KERN_ERR PFX "%s: could not request regions.\n", if (netif_msg_probe(tp))
pr_err("%s: could not request regions\n",
pci_name(pdev)); pci_name(pdev));
goto err_pci_disable_2; goto err_pci_disable_2;
} }
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc < 0) { if (rc < 0) {
net_probe(tp, KERN_ERR "%s: DMA configuration failed.\n", if (netif_msg_probe(tp))
pr_err("%s: DMA configuration failed\n",
pci_name(pdev)); pci_name(pdev));
goto err_free_res_3; goto err_free_res_3;
} }
...@@ -1500,7 +1493,8 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) ...@@ -1500,7 +1493,8 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev)
ioaddr = ioremap(pci_resource_start(pdev, 0), SIS190_REGS_SIZE); ioaddr = ioremap(pci_resource_start(pdev, 0), SIS190_REGS_SIZE);
if (!ioaddr) { if (!ioaddr) {
net_probe(tp, KERN_ERR "%s: cannot remap MMIO, aborting\n", if (netif_msg_probe(tp))
pr_err("%s: cannot remap MMIO, aborting\n",
pci_name(pdev)); pci_name(pdev));
rc = -EIO; rc = -EIO;
goto err_free_res_3; goto err_free_res_3;
...@@ -1537,9 +1531,8 @@ static void sis190_tx_timeout(struct net_device *dev) ...@@ -1537,9 +1531,8 @@ static void sis190_tx_timeout(struct net_device *dev)
if (tmp8 & CmdTxEnb) if (tmp8 & CmdTxEnb)
SIS_W8(TxControl, tmp8 & ~CmdTxEnb); SIS_W8(TxControl, tmp8 & ~CmdTxEnb);
netif_info(tp, tx_err, dev, "Transmit timeout, status %08x %08x\n",
net_tx_err(tp, KERN_INFO "%s: Transmit timeout, status %08x %08x.\n", SIS_R32(TxControl), SIS_R32(TxSts));
dev->name, SIS_R32(TxControl), SIS_R32(TxSts));
/* Disable interrupts by clearing the interrupt mask. */ /* Disable interrupts by clearing the interrupt mask. */
SIS_W32(IntrMask, 0x0000); SIS_W32(IntrMask, 0x0000);
...@@ -1568,14 +1561,15 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev, ...@@ -1568,14 +1561,15 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
u16 sig; u16 sig;
int i; int i;
net_probe(tp, KERN_INFO "%s: Read MAC address from EEPROM\n", if (netif_msg_probe(tp))
pci_name(pdev)); pr_info("%s: Read MAC address from EEPROM\n", pci_name(pdev));
/* Check to see if there is a sane EEPROM */ /* Check to see if there is a sane EEPROM */
sig = (u16) sis190_read_eeprom(ioaddr, EEPROMSignature); sig = (u16) sis190_read_eeprom(ioaddr, EEPROMSignature);
if ((sig == 0xffff) || (sig == 0x0000)) { if ((sig == 0xffff) || (sig == 0x0000)) {
net_probe(tp, KERN_INFO "%s: Error EEPROM read %x.\n", if (netif_msg_probe(tp))
pr_info("%s: Error EEPROM read %x\n",
pci_name(pdev), sig); pci_name(pdev), sig);
return -EIO; return -EIO;
} }
...@@ -1610,8 +1604,8 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, ...@@ -1610,8 +1604,8 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
u8 reg, tmp8; u8 reg, tmp8;
unsigned int i; unsigned int i;
net_probe(tp, KERN_INFO "%s: Read MAC address from APC.\n", if (netif_msg_probe(tp))
pci_name(pdev)); pr_info("%s: Read MAC address from APC\n", pci_name(pdev));
for (i = 0; i < ARRAY_SIZE(ids); i++) { for (i = 0; i < ARRAY_SIZE(ids); i++) {
isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL); isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL);
...@@ -1620,7 +1614,8 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, ...@@ -1620,7 +1614,8 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
} }
if (!isa_bridge) { if (!isa_bridge) {
net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", if (netif_msg_probe(tp))
pr_info("%s: Can not find ISA bridge\n",
pci_name(pdev)); pci_name(pdev));
return -EIO; return -EIO;
} }
...@@ -1702,7 +1697,7 @@ static void sis190_set_speed_auto(struct net_device *dev) ...@@ -1702,7 +1697,7 @@ static void sis190_set_speed_auto(struct net_device *dev)
int phy_id = tp->mii_if.phy_id; int phy_id = tp->mii_if.phy_id;
int val; int val;
net_link(tp, KERN_INFO "%s: Enabling Auto-negotiation.\n", dev->name); netif_info(tp, link, dev, "Enabling Auto-negotiation\n");
val = mdio_read(ioaddr, phy_id, MII_ADVERTISE); val = mdio_read(ioaddr, phy_id, MII_ADVERTISE);
...@@ -1829,7 +1824,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, ...@@ -1829,7 +1824,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
int rc; int rc;
if (!printed_version) { if (!printed_version) {
net_drv(&debug, KERN_INFO SIS190_DRIVER_NAME " loaded.\n"); if (netif_msg_drv(&debug))
pr_info(SIS190_DRIVER_NAME " loaded\n");
printed_version = 1; printed_version = 1;
} }
...@@ -1869,12 +1865,14 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, ...@@ -1869,12 +1865,14 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
if (rc < 0) if (rc < 0)
goto err_remove_mii; goto err_remove_mii;
net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), %pM\n", if (netif_msg_probe(tp)) {
pci_name(pdev), sis_chip_info[ent->driver_data].name, netdev_info(dev, "%s: %s at %p (IRQ: %d), %pM\n",
pci_name(pdev),
sis_chip_info[ent->driver_data].name,
ioaddr, dev->irq, dev->dev_addr); ioaddr, dev->irq, dev->dev_addr);
netdev_info(dev, "%s mode.\n",
net_probe(tp, KERN_INFO "%s: %s mode.\n", dev->name,
(tp->features & F_HAS_RGMII) ? "RGMII" : "GMII"); (tp->features & F_HAS_RGMII) ? "RGMII" : "GMII");
}
netif_carrier_off(dev); netif_carrier_off(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment