tlan: Use pr_fmt, pr_<level> and netdev_<level>

Neatening and standardization to the current logging mechanisms.
Miscellaneous speen/speed typo correction.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Joe Perches 2011-03-01 06:56:33 +00:00 committed by David S. Miller
parent a576cd8700
commit 50624aab53

View file

@ -27,6 +27,8 @@
* *
******************************************************************************/ ******************************************************************************/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
@ -59,7 +61,7 @@ module_param_array(speed, int, NULL, 0);
MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)"); MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)");
MODULE_PARM_DESC(duplex, MODULE_PARM_DESC(duplex,
"ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)"); "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)");
MODULE_PARM_DESC(speed, "ThunderLAN port speen setting(s) (0,10,100)"); MODULE_PARM_DESC(speed, "ThunderLAN port speed setting(s) (0,10,100)");
MODULE_AUTHOR("Maintainer: Samuel Chessman <chessman@tux.org>"); MODULE_AUTHOR("Maintainer: Samuel Chessman <chessman@tux.org>");
MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters"); MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters");
@ -397,7 +399,7 @@ static int __init tlan_probe(void)
{ {
int rc = -ENODEV; int rc = -ENODEV;
printk(KERN_INFO "%s", tlan_banner); pr_info("%s", tlan_banner);
TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n"); TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");
@ -406,16 +408,16 @@ static int __init tlan_probe(void)
rc = pci_register_driver(&tlan_driver); rc = pci_register_driver(&tlan_driver);
if (rc != 0) { if (rc != 0) {
printk(KERN_ERR "TLAN: Could not register pci driver.\n"); pr_err("Could not register pci driver\n");
goto err_out_pci_free; goto err_out_pci_free;
} }
TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n"); TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n");
tlan_eisa_probe(); tlan_eisa_probe();
printk(KERN_INFO "TLAN: %d device%s installed, PCI: %d EISA: %d\n", pr_info("%d device%s installed, PCI: %d EISA: %d\n",
tlan_devices_installed, tlan_devices_installed == 1 ? "" : "s", tlan_devices_installed, tlan_devices_installed == 1 ? "" : "s",
tlan_have_pci, tlan_have_eisa); tlan_have_pci, tlan_have_eisa);
if (tlan_devices_installed == 0) { if (tlan_devices_installed == 0) {
rc = -ENODEV; rc = -ENODEV;
@ -474,7 +476,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
rc = pci_request_regions(pdev, tlan_signature); rc = pci_request_regions(pdev, tlan_signature);
if (rc) { if (rc) {
printk(KERN_ERR "TLAN: Could not reserve IO regions\n"); pr_err("Could not reserve IO regions\n");
goto err_out; goto err_out;
} }
} }
@ -482,7 +484,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
dev = alloc_etherdev(sizeof(struct tlan_priv)); dev = alloc_etherdev(sizeof(struct tlan_priv));
if (dev == NULL) { if (dev == NULL) {
printk(KERN_ERR "TLAN: Could not allocate memory for device.\n"); pr_err("Could not allocate memory for device\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_regions; goto err_out_regions;
} }
@ -501,8 +503,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc) { if (rc) {
printk(KERN_ERR pr_err("No suitable PCI mapping available\n");
"TLAN: No suitable PCI mapping available.\n");
goto err_out_free_dev; goto err_out_free_dev;
} }
@ -516,7 +517,7 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
} }
} }
if (!pci_io_base) { if (!pci_io_base) {
printk(KERN_ERR "TLAN: No IO mappings available\n"); pr_err("No IO mappings available\n");
rc = -EIO; rc = -EIO;
goto err_out_free_dev; goto err_out_free_dev;
} }
@ -572,13 +573,13 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
rc = tlan_init(dev); rc = tlan_init(dev);
if (rc) { if (rc) {
printk(KERN_ERR "TLAN: Could not set up device.\n"); pr_err("Could not set up device\n");
goto err_out_free_dev; goto err_out_free_dev;
} }
rc = register_netdev(dev); rc = register_netdev(dev);
if (rc) { if (rc) {
printk(KERN_ERR "TLAN: Could not register device.\n"); pr_err("Could not register device\n");
goto err_out_uninit; goto err_out_uninit;
} }
@ -595,12 +596,11 @@ static int __devinit tlan_probe1(struct pci_dev *pdev,
tlan_have_eisa++; tlan_have_eisa++;
} }
printk(KERN_INFO "TLAN: %s irq=%2d, io=%04x, %s, Rev. %d\n", netdev_info(dev, "irq=%2d, io=%04x, %s, Rev. %d\n",
dev->name, (int)dev->irq,
(int) dev->irq, (int)dev->base_addr,
(int) dev->base_addr, priv->adapter->device_label,
priv->adapter->device_label, priv->adapter_rev);
priv->adapter_rev);
return 0; return 0;
err_out_uninit: err_out_uninit:
@ -716,7 +716,7 @@ static void __init tlan_eisa_probe(void)
} }
if (debug == 0x10) if (debug == 0x10)
printk(KERN_INFO "Found one\n"); pr_info("Found one\n");
/* Get irq from board */ /* Get irq from board */
@ -745,12 +745,12 @@ static void __init tlan_eisa_probe(void)
out: out:
if (debug == 0x10) if (debug == 0x10)
printk(KERN_INFO "None found\n"); pr_info("None found\n");
continue; continue;
out2: out2:
if (debug == 0x10) if (debug == 0x10)
printk(KERN_INFO "Card found but it is not enabled, skipping\n"); pr_info("Card found but it is not enabled, skipping\n");
continue; continue;
} }
@ -818,8 +818,7 @@ static int tlan_init(struct net_device *dev)
priv->dma_size = dma_size; priv->dma_size = dma_size;
if (priv->dma_storage == NULL) { if (priv->dma_storage == NULL) {
printk(KERN_ERR pr_err("Could not allocate lists and buffers for %s\n",
"TLAN: Could not allocate lists and buffers for %s.\n",
dev->name); dev->name);
return -ENOMEM; return -ENOMEM;
} }
@ -837,9 +836,8 @@ static int tlan_init(struct net_device *dev)
(u8) priv->adapter->addr_ofs + i, (u8) priv->adapter->addr_ofs + i,
(u8 *) &dev->dev_addr[i]); (u8 *) &dev->dev_addr[i]);
if (err) { if (err) {
printk(KERN_ERR "TLAN: %s: Error reading MAC from eeprom: %d\n", pr_err("%s: Error reading MAC from eeprom: %d\n",
dev->name, dev->name, err);
err);
} }
dev->addr_len = 6; dev->addr_len = 6;
@ -883,8 +881,8 @@ static int tlan_open(struct net_device *dev)
dev->name, dev); dev->name, dev);
if (err) { if (err) {
pr_err("TLAN: Cannot open %s because IRQ %d is already in use.\n", netdev_err(dev, "Cannot open because IRQ %d is already in use\n",
dev->name, dev->irq); dev->irq);
return err; return err;
} }
@ -1367,8 +1365,8 @@ static u32 tlan_handle_tx_eof(struct net_device *dev, u16 host_int)
} }
if (!ack) if (!ack)
printk(KERN_INFO netdev_info(dev,
"TLAN: Received interrupt for uncompleted TX frame.\n"); "Received interrupt for uncompleted TX frame\n");
if (eoc) { if (eoc) {
TLAN_DBG(TLAN_DEBUG_TX, TLAN_DBG(TLAN_DEBUG_TX,
@ -1522,8 +1520,8 @@ static u32 tlan_handle_rx_eof(struct net_device *dev, u16 host_int)
} }
if (!ack) if (!ack)
printk(KERN_INFO netdev_info(dev,
"TLAN: Received interrupt for uncompleted RX frame.\n"); "Received interrupt for uncompleted RX frame\n");
if (eoc) { if (eoc) {
@ -1579,7 +1577,7 @@ static u32 tlan_handle_rx_eof(struct net_device *dev, u16 host_int)
static u32 tlan_handle_dummy(struct net_device *dev, u16 host_int) static u32 tlan_handle_dummy(struct net_device *dev, u16 host_int)
{ {
pr_info("TLAN: Test interrupt on %s.\n", dev->name); netdev_info(dev, "Test interrupt\n");
return 1; return 1;
} }
@ -1673,7 +1671,7 @@ static u32 tlan_handle_status_check(struct net_device *dev, u16 host_int)
if (host_int & TLAN_HI_IV_MASK) { if (host_int & TLAN_HI_IV_MASK) {
netif_stop_queue(dev); netif_stop_queue(dev);
error = inl(dev->base_addr + TLAN_CH_PARM); error = inl(dev->base_addr + TLAN_CH_PARM);
pr_info("TLAN: %s: Adaptor Error = 0x%x\n", dev->name, error); netdev_info(dev, "Adaptor Error = 0x%x\n", error);
tlan_read_and_clear_stats(dev, TLAN_RECORD); tlan_read_and_clear_stats(dev, TLAN_RECORD);
outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD); outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD);
@ -1914,7 +1912,7 @@ static void tlan_reset_lists(struct net_device *dev)
list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER; list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER;
skb = netdev_alloc_skb_ip_align(dev, TLAN_MAX_FRAME_SIZE + 5); skb = netdev_alloc_skb_ip_align(dev, TLAN_MAX_FRAME_SIZE + 5);
if (!skb) { if (!skb) {
pr_err("TLAN: out of memory for received data.\n"); netdev_err(dev, "Out of memory for received data\n");
break; break;
} }
@ -1998,13 +1996,13 @@ static void tlan_print_dio(u16 io_base)
u32 data0, data1; u32 data0, data1;
int i; int i;
pr_info("TLAN: Contents of internal registers for io base 0x%04hx.\n", pr_info("Contents of internal registers for io base 0x%04hx\n",
io_base); io_base);
pr_info("TLAN: Off. +0 +4\n"); pr_info("Off. +0 +4\n");
for (i = 0; i < 0x4C; i += 8) { for (i = 0; i < 0x4C; i += 8) {
data0 = tlan_dio_read32(io_base, i); data0 = tlan_dio_read32(io_base, i);
data1 = tlan_dio_read32(io_base, i + 0x4); data1 = tlan_dio_read32(io_base, i + 0x4);
pr_info("TLAN: 0x%02x 0x%08x 0x%08x\n", i, data0, data1); pr_info("0x%02x 0x%08x 0x%08x\n", i, data0, data1);
} }
} }
@ -2033,14 +2031,14 @@ static void tlan_print_list(struct tlan_list *list, char *type, int num)
{ {
int i; int i;
pr_info("TLAN: %s List %d at %p\n", type, num, list); pr_info("%s List %d at %p\n", type, num, list);
pr_info("TLAN: Forward = 0x%08x\n", list->forward); pr_info(" Forward = 0x%08x\n", list->forward);
pr_info("TLAN: CSTAT = 0x%04hx\n", list->c_stat); pr_info(" CSTAT = 0x%04hx\n", list->c_stat);
pr_info("TLAN: Frame Size = 0x%04hx\n", list->frame_size); pr_info(" Frame Size = 0x%04hx\n", list->frame_size);
/* for (i = 0; i < 10; i++) { */ /* for (i = 0; i < 10; i++) { */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
pr_info("TLAN: Buffer[%d].count, addr = 0x%08x, 0x%08x\n", pr_info(" Buffer[%d].count, addr = 0x%08x, 0x%08x\n",
i, list->buffer[i].count, list->buffer[i].address); i, list->buffer[i].count, list->buffer[i].address);
} }
} }
@ -2255,7 +2253,7 @@ tlan_finish_reset(struct net_device *dev)
if ((priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) || if ((priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) ||
(priv->aui)) { (priv->aui)) {
status = MII_GS_LINK; status = MII_GS_LINK;
pr_info("TLAN: %s: Link forced.\n", dev->name); netdev_info(dev, "Link forced\n");
} else { } else {
tlan_mii_read_reg(dev, phy, MII_GEN_STS, &status); tlan_mii_read_reg(dev, phy, MII_GEN_STS, &status);
udelay(1000); udelay(1000);
@ -2267,24 +2265,21 @@ tlan_finish_reset(struct net_device *dev)
tlan_mii_read_reg(dev, phy, MII_AN_LPA, &partner); tlan_mii_read_reg(dev, phy, MII_AN_LPA, &partner);
tlan_mii_read_reg(dev, phy, TLAN_TLPHY_PAR, &tlphy_par); tlan_mii_read_reg(dev, phy, TLAN_TLPHY_PAR, &tlphy_par);
pr_info("TLAN: %s: Link active with ", dev->name); netdev_info(dev,
if (!(tlphy_par & TLAN_PHY_AN_EN_STAT)) { "Link active with %s %uMbps %s-Duplex\n",
pr_info("forced 10%sMbps %s-Duplex\n", !(tlphy_par & TLAN_PHY_AN_EN_STAT)
tlphy_par & TLAN_PHY_SPEED_100 ? "forced" : "Autonegotiation enabled,",
? "" : "0", tlphy_par & TLAN_PHY_SPEED_100
tlphy_par & TLAN_PHY_DUPLEX_FULL ? 100 : 10,
? "Full" : "Half"); tlphy_par & TLAN_PHY_DUPLEX_FULL
} else { ? "Full" : "Half");
pr_info("Autonegotiation enabled, at 10%sMbps %s-Duplex\n",
tlphy_par & TLAN_PHY_SPEED_100 if (tlphy_par & TLAN_PHY_AN_EN_STAT) {
? "" : "0", netdev_info(dev, "Partner capability:");
tlphy_par & TLAN_PHY_DUPLEX_FULL for (i = 5; i < 10; i++)
? "Full" : "half"); if (partner & (1 << i))
pr_info("TLAN: Partner capability: "); pr_cont(" %s", media[i-5]);
for (i = 5; i <= 10; i++) pr_cont("\n");
if (partner & (1<<i))
printk("%s", media[i-5]);
printk("\n");
} }
tlan_dio_write8(dev->base_addr, TLAN_LED_REG, tlan_dio_write8(dev->base_addr, TLAN_LED_REG,
@ -2296,7 +2291,7 @@ tlan_finish_reset(struct net_device *dev)
tlan_set_timer(dev, (10*HZ), TLAN_TIMER_LINK_BEAT); tlan_set_timer(dev, (10*HZ), TLAN_TIMER_LINK_BEAT);
#endif #endif
} else if (status & MII_GS_LINK) { } else if (status & MII_GS_LINK) {
pr_info("TLAN: %s: Link active\n", dev->name); netdev_info(dev, "Link active\n");
tlan_dio_write8(dev->base_addr, TLAN_LED_REG, tlan_dio_write8(dev->base_addr, TLAN_LED_REG,
TLAN_LED_LINK); TLAN_LED_LINK);
} }
@ -2322,8 +2317,7 @@ tlan_finish_reset(struct net_device *dev)
outl(TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD); outl(TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD);
netif_carrier_on(dev); netif_carrier_on(dev);
} else { } else {
pr_info("TLAN: %s: Link inactive, will retry in 10 secs...\n", netdev_info(dev, "Link inactive, will retry in 10 secs...\n");
dev->name);
tlan_set_timer(dev, (10*HZ), TLAN_TIMER_FINISH_RESET); tlan_set_timer(dev, (10*HZ), TLAN_TIMER_FINISH_RESET);
return; return;
} }
@ -2407,23 +2401,20 @@ static void tlan_phy_print(struct net_device *dev)
phy = priv->phy[priv->phy_num]; phy = priv->phy[priv->phy_num];
if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) { if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) {
pr_info("TLAN: Device %s, Unmanaged PHY.\n", dev->name); netdev_info(dev, "Unmanaged PHY\n");
} else if (phy <= TLAN_PHY_MAX_ADDR) { } else if (phy <= TLAN_PHY_MAX_ADDR) {
pr_info("TLAN: Device %s, PHY 0x%02x.\n", dev->name, phy); netdev_info(dev, "PHY 0x%02x\n", phy);
pr_info("TLAN: Off. +0 +1 +2 +3\n"); pr_info(" Off. +0 +1 +2 +3\n");
for (i = 0; i < 0x20; i += 4) { for (i = 0; i < 0x20; i += 4) {
pr_info("TLAN: 0x%02x", i);
tlan_mii_read_reg(dev, phy, i, &data0); tlan_mii_read_reg(dev, phy, i, &data0);
printk(" 0x%04hx", data0);
tlan_mii_read_reg(dev, phy, i + 1, &data1); tlan_mii_read_reg(dev, phy, i + 1, &data1);
printk(" 0x%04hx", data1);
tlan_mii_read_reg(dev, phy, i + 2, &data2); tlan_mii_read_reg(dev, phy, i + 2, &data2);
printk(" 0x%04hx", data2);
tlan_mii_read_reg(dev, phy, i + 3, &data3); tlan_mii_read_reg(dev, phy, i + 3, &data3);
printk(" 0x%04hx\n", data3); pr_info(" 0x%02x 0x%04hx 0x%04hx 0x%04hx 0x%04hx\n",
i, data0, data1, data2, data3);
} }
} else { } else {
pr_info("TLAN: Device %s, Invalid PHY.\n", dev->name); netdev_info(dev, "Invalid PHY\n");
} }
} }
@ -2490,7 +2481,7 @@ static void tlan_phy_detect(struct net_device *dev)
else if (priv->phy[0] != TLAN_PHY_NONE) else if (priv->phy[0] != TLAN_PHY_NONE)
priv->phy_num = 0; priv->phy_num = 0;
else else
pr_info("TLAN: Cannot initialize device, no PHY was found!\n"); netdev_info(dev, "Cannot initialize device, no PHY was found!\n");
} }
@ -2618,8 +2609,7 @@ static void tlan_phy_start_link(struct net_device *dev)
* but the card need additional time to start AN. * but the card need additional time to start AN.
* .5 sec should be plenty extra. * .5 sec should be plenty extra.
*/ */
pr_info("TLAN: %s: Starting autonegotiation.\n", netdev_info(dev, "Starting autonegotiation\n");
dev->name);
tlan_set_timer(dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN); tlan_set_timer(dev, (2*HZ), TLAN_TIMER_PHY_FINISH_AN);
return; return;
} }
@ -2682,16 +2672,16 @@ static void tlan_phy_finish_auto_neg(struct net_device *dev)
* more time. Perhaps we should fail after a while. * more time. Perhaps we should fail after a while.
*/ */
if (!priv->neg_be_verbose++) { if (!priv->neg_be_verbose++) {
pr_info("TLAN: Giving autonegotiation more time.\n"); pr_info("Giving autonegotiation more time.\n");
pr_info("TLAN: Please check that your adapter has\n"); pr_info("Please check that your adapter has\n");
pr_info("TLAN: been properly connected to a HUB or Switch.\n"); pr_info("been properly connected to a HUB or Switch.\n");
pr_info("TLAN: Trying to establish link in the background...\n"); pr_info("Trying to establish link in the background...\n");
} }
tlan_set_timer(dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN); tlan_set_timer(dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN);
return; return;
} }
pr_info("TLAN: %s: Autonegotiation complete.\n", dev->name); netdev_info(dev, "Autonegotiation complete\n");
tlan_mii_read_reg(dev, phy, MII_AN_ADV, &an_adv); tlan_mii_read_reg(dev, phy, MII_AN_ADV, &an_adv);
tlan_mii_read_reg(dev, phy, MII_AN_LPA, &an_lpa); tlan_mii_read_reg(dev, phy, MII_AN_LPA, &an_lpa);
mode = an_adv & an_lpa & 0x03E0; mode = an_adv & an_lpa & 0x03E0;
@ -2716,11 +2706,11 @@ static void tlan_phy_finish_auto_neg(struct net_device *dev)
(an_adv & an_lpa & 0x0040)) { (an_adv & an_lpa & 0x0040)) {
tlan_mii_write_reg(dev, phy, MII_GEN_CTL, tlan_mii_write_reg(dev, phy, MII_GEN_CTL,
MII_GC_AUTOENB | MII_GC_DUPLEX); MII_GC_AUTOENB | MII_GC_DUPLEX);
pr_info("TLAN: Starting internal PHY with FULL-DUPLEX\n"); netdev_info(dev, "Starting internal PHY with FULL-DUPLEX\n");
} else { } else {
tlan_mii_write_reg(dev, phy, MII_GEN_CTL, tlan_mii_write_reg(dev, phy, MII_GEN_CTL,
MII_GC_AUTOENB); MII_GC_AUTOENB);
pr_info("TLAN: Starting internal PHY with HALF-DUPLEX\n"); netdev_info(dev, "Starting internal PHY with HALF-DUPLEX\n");
} }
} }