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.
Unified · Split
| @@ -192,12 +192,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 191 unmodified lines | ||
| 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,7 +225,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 21 unmodified lines | ||
| 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 | } |
| @@ -320,10 +321,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 88 unmodified lines | ||
| 320 | 321 | |
| 321 | 322 | slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); |
| 322 | 323 | if (slave_dev == NULL) { |
| 323 | − printk(KERN_ERR "%s[%d]: can't create dsa " | |
| 324 | − "slave device for port %d(%s)\n", | |
| 325 | − dst->master_netdev->name, | |
| 326 | − index, i, pd->port_names[i]); | |
| 324 | + netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n", | |
| 325 | + index, i, pd->port_names[i]); | |
| 327 | 326 | continue; |
| 328 | 327 | } |
| 329 | 328 | |
| @@ -701,15 +700,13 @@ static inline void dsa_of_remove(struct platform_device *pdev) · 371 unmodified lines | ||
| 701 | 700 | |
| 702 | 701 | static int dsa_probe(struct platform_device *pdev) |
| 703 | 702 | { |
| 704 | − static int dsa_version_printed; | |
| 705 | 703 | struct dsa_platform_data *pd = pdev->dev.platform_data; |
| 706 | 704 | struct net_device *dev; |
| 707 | 705 | struct dsa_switch_tree *dst; |
| 708 | 706 | int i, ret; |
| 709 | 707 | |
| 710 | − if (!dsa_version_printed++) | |
| 711 | − printk(KERN_NOTICE "Distributed Switch Architecture " | |
| 712 | − "driver version %s\n", dsa_driver_version); | |
| 708 | + pr_notice_once("Distributed Switch Architecture driver version %s\n", | |
| 709 | + dsa_driver_version); | |
| 713 | 710 | |
| 714 | 711 | if (pdev->dev.of_node) { |
| 715 | 712 | ret = dsa_of_probe(pdev); |
| @@ -753,9 +750,8 @@ static int dsa_probe(struct platform_device *pdev) · 37 unmodified lines | ||
| 753 | 750 | |
| 754 | 751 | ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev); |
| 755 | 752 | if (IS_ERR(ds)) { |
| 756 | − printk(KERN_ERR "%s[%d]: couldn't create dsa switch " | |
| 757 | − "instance (error %ld)\n", dev->name, i, | |
| 758 | − PTR_ERR(ds)); | |
| 753 | + netdev_err(dev, "[%d]: couldn't create dsa switch instance (error %ld)\n", | |
| 754 | + i, PTR_ERR(ds)); | |
| 759 | 755 | continue; |
| 760 | 756 | } |
| 761 | 757 | |
| @@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, · 531 unmodified lines | ||
| 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,8 +558,8 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, · 19 unmodified lines | ||
| 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,8 +657,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, · 91 unmodified lines | ||
| 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 | } |