diff options
author | Joe Perches <joe@perches.com> | 2014-11-09 19:32:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-11 13:30:57 -0500 |
commit | a2ae6007a442d6bb27d77bf20ec1b06cda9e306e (patch) | |
tree | 6bf28d8f5d0e87c274465178e7ef211f3a1c1a9f /net/dsa | |
parent | 008e81656c32e34c0b248bd203872d15be8770b7 (diff) |
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>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa.c | 28 | ||||
-rw-r--r-- | net/dsa/slave.c | 10 |
2 files changed, 17 insertions, 21 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index dd646a8025cb..4648f12098ad 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -192,12 +192,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
192 | */ | 192 | */ |
193 | drv = dsa_switch_probe(host_dev, pd->sw_addr, &name); | 193 | drv = dsa_switch_probe(host_dev, pd->sw_addr, &name); |
194 | if (drv == NULL) { | 194 | if (drv == NULL) { |
195 | printk(KERN_ERR "%s[%d]: could not detect attached switch\n", | 195 | netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n", |
196 | dst->master_netdev->name, index); | 196 | index); |
197 | return ERR_PTR(-EINVAL); | 197 | return ERR_PTR(-EINVAL); |
198 | } | 198 | } |
199 | printk(KERN_INFO "%s[%d]: detected a %s switch\n", | 199 | netdev_info(dst->master_netdev, "[%d]: detected a %s switch\n", |
200 | dst->master_netdev->name, index, name); | 200 | index, name); |
201 | 201 | ||
202 | 202 | ||
203 | /* | 203 | /* |
@@ -225,7 +225,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
225 | 225 | ||
226 | if (!strcmp(name, "cpu")) { | 226 | if (!strcmp(name, "cpu")) { |
227 | if (dst->cpu_switch != -1) { | 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 | ret = -EINVAL; | 230 | ret = -EINVAL; |
230 | goto out; | 231 | goto out; |
231 | } | 232 | } |
@@ -320,10 +321,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
320 | 321 | ||
321 | slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); | 322 | slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); |
322 | if (slave_dev == NULL) { | 323 | if (slave_dev == NULL) { |
323 | printk(KERN_ERR "%s[%d]: can't create dsa " | 324 | netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n", |
324 | "slave device for port %d(%s)\n", | 325 | index, i, pd->port_names[i]); |
325 | dst->master_netdev->name, | ||
326 | index, i, pd->port_names[i]); | ||
327 | continue; | 326 | continue; |
328 | } | 327 | } |
329 | 328 | ||
@@ -701,15 +700,13 @@ static inline void dsa_of_remove(struct platform_device *pdev) | |||
701 | 700 | ||
702 | static int dsa_probe(struct platform_device *pdev) | 701 | static int dsa_probe(struct platform_device *pdev) |
703 | { | 702 | { |
704 | static int dsa_version_printed; | ||
705 | struct dsa_platform_data *pd = pdev->dev.platform_data; | 703 | struct dsa_platform_data *pd = pdev->dev.platform_data; |
706 | struct net_device *dev; | 704 | struct net_device *dev; |
707 | struct dsa_switch_tree *dst; | 705 | struct dsa_switch_tree *dst; |
708 | int i, ret; | 706 | int i, ret; |
709 | 707 | ||
710 | if (!dsa_version_printed++) | 708 | pr_notice_once("Distributed Switch Architecture driver version %s\n", |
711 | printk(KERN_NOTICE "Distributed Switch Architecture " | 709 | dsa_driver_version); |
712 | "driver version %s\n", dsa_driver_version); | ||
713 | 710 | ||
714 | if (pdev->dev.of_node) { | 711 | if (pdev->dev.of_node) { |
715 | ret = dsa_of_probe(pdev); | 712 | ret = dsa_of_probe(pdev); |
@@ -753,9 +750,8 @@ static int dsa_probe(struct platform_device *pdev) | |||
753 | 750 | ||
754 | ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev); | 751 | ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev); |
755 | if (IS_ERR(ds)) { | 752 | if (IS_ERR(ds)) { |
756 | printk(KERN_ERR "%s[%d]: couldn't create dsa switch " | 753 | netdev_err(dev, "[%d]: couldn't create dsa switch instance (error %ld)\n", |
757 | "instance (error %ld)\n", dev->name, i, | 754 | i, PTR_ERR(ds)); |
758 | PTR_ERR(ds)); | ||
759 | continue; | 755 | continue; |
760 | } | 756 | } |
761 | 757 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 0ea466dad818..528380a3e296 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
532 | */ | 532 | */ |
533 | ret = of_phy_register_fixed_link(port_dn); | 533 | ret = of_phy_register_fixed_link(port_dn); |
534 | if (ret) { | 534 | if (ret) { |
535 | pr_err("failed to register fixed PHY\n"); | 535 | netdev_err(slave_dev, "failed to register fixed PHY\n"); |
536 | return; | 536 | return; |
537 | } | 537 | } |
538 | phy_is_fixed = true; | 538 | phy_is_fixed = true; |
@@ -558,8 +558,8 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
558 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, | 558 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, |
559 | p->phy_interface); | 559 | p->phy_interface); |
560 | } else { | 560 | } else { |
561 | pr_info("attached PHY at address %d [%s]\n", | 561 | netdev_info(slave_dev, "attached PHY at address %d [%s]\n", |
562 | p->phy->addr, p->phy->drv->name); | 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, | |||
657 | 657 | ||
658 | ret = register_netdev(slave_dev); | 658 | ret = register_netdev(slave_dev); |
659 | if (ret) { | 659 | if (ret) { |
660 | printk(KERN_ERR "%s: error %d registering interface %s\n", | 660 | netdev_err(master, "error %d registering interface %s\n", |
661 | master->name, ret, slave_dev->name); | 661 | ret, slave_dev->name); |
662 | free_netdev(slave_dev); | 662 | free_netdev(slave_dev); |
663 | return NULL; | 663 | return NULL; |
664 | } | 664 | } |