Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dsa: Use netdev_<level> instead of printk

Neaten and standardize the logging output.

Other miscellanea:

o Use pr_notice_once instead of a guard flag.
o Convert existing pr_<level> uses too.

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

authored by

Joe Perches and committed by
David S. Miller
a2ae6007 008e8165

+17 -21
+12 -16
net/dsa/dsa.c
··· 192 192 */ 193 193 drv = dsa_switch_probe(host_dev, pd->sw_addr, &name); 194 194 if (drv == NULL) { 195 - printk(KERN_ERR "%s[%d]: could not detect attached switch\n", 196 - dst->master_netdev->name, index); 195 + netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", 196 + index); 197 197 return ERR_PTR(-EINVAL); 198 198 } 199 - printk(KERN_INFO "%s[%d]: detected a %s switch\n", 200 - dst->master_netdev->name, index, name); 199 + netdev_info(dst->master_netdev, "[%d]: detected a %s switch\n", 200 + index, name); 201 201 202 202 203 203 /* ··· 225 225 226 226 if (!strcmp(name, "cpu")) { 227 227 if (dst->cpu_switch != -1) { 228 - printk(KERN_ERR "multiple cpu ports?!\n"); 228 + netdev_err(dst->master_netdev, 229 + "multiple cpu ports?!\n"); 229 230 ret = -EINVAL; 230 231 goto out; 231 232 } ··· 321 320 322 321 slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); 323 322 if (slave_dev == NULL) { 324 - printk(KERN_ERR "%s[%d]: can't create dsa " 325 - "slave device for port %d(%s)\n", 326 - dst->master_netdev->name, 327 - index, i, pd->port_names[i]); 323 + netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n", 324 + index, i, pd->port_names[i]); 328 325 continue; 329 326 } 330 327 ··· 700 701 701 702 static int dsa_probe(struct platform_device *pdev) 702 703 { 703 - static int dsa_version_printed; 704 704 struct dsa_platform_data *pd = pdev->dev.platform_data; 705 705 struct net_device *dev; 706 706 struct dsa_switch_tree *dst; 707 707 int i, ret; 708 708 709 - if (!dsa_version_printed++) 710 - printk(KERN_NOTICE "Distributed Switch Architecture " 711 - "driver version %s\n", dsa_driver_version); 709 + pr_notice_once("Distributed Switch Architecture driver version %s\n", 710 + dsa_driver_version); 712 711 713 712 if (pdev->dev.of_node) { 714 713 ret = dsa_of_probe(pdev); ··· 750 753 751 754 ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev); 752 755 if (IS_ERR(ds)) { 753 - printk(KERN_ERR "%s[%d]: couldn't create dsa switch " 754 - "instance (error %ld)\n", dev->name, i, 755 - PTR_ERR(ds)); 756 + netdev_err(dev, "[%d]: couldn't create dsa switch instance (error %ld)\n", 757 + i, PTR_ERR(ds)); 756 758 continue; 757 759 } 758 760
+5 -5
net/dsa/slave.c
··· 532 532 */ 533 533 ret = of_phy_register_fixed_link(port_dn); 534 534 if (ret) { 535 - pr_err("failed to register fixed PHY\n"); 535 + netdev_err(slave_dev, "failed to register fixed PHY\n"); 536 536 return; 537 537 } 538 538 phy_is_fixed = true; ··· 558 558 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, 559 559 p->phy_interface); 560 560 } else { 561 - pr_info("attached PHY at address %d [%s]\n", 562 - p->phy->addr, p->phy->drv->name); 561 + netdev_info(slave_dev, "attached PHY at address %d [%s]\n", 562 + p->phy->addr, p->phy->drv->name); 563 563 } 564 564 } 565 565 ··· 657 657 658 658 ret = register_netdev(slave_dev); 659 659 if (ret) { 660 - printk(KERN_ERR "%s: error %d registering interface %s\n", 661 - master->name, ret, slave_dev->name); 660 + netdev_err(master, "error %d registering interface %s\n", 661 + ret, slave_dev->name); 662 662 free_netdev(slave_dev); 663 663 return NULL; 664 664 }