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

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 008e8165
...@@ -192,12 +192,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, ...@@ -192,12 +192,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
*/ */
drv = dsa_switch_probe(host_dev, pd->sw_addr, &name); drv = dsa_switch_probe(host_dev, pd->sw_addr, &name);
if (drv == NULL) { if (drv == NULL) {
printk(KERN_ERR "%s[%d]: could not detect attached switch\n", netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n",
dst->master_netdev->name, index); index);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
printk(KERN_INFO "%s[%d]: detected a %s switch\n", netdev_info(dst->master_netdev, "[%d]: detected a %s switch\n",
dst->master_netdev->name, index, name); index, name);
/* /*
...@@ -225,7 +225,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, ...@@ -225,7 +225,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
if (!strcmp(name, "cpu")) { if (!strcmp(name, "cpu")) {
if (dst->cpu_switch != -1) { if (dst->cpu_switch != -1) {
printk(KERN_ERR "multiple cpu ports?!\n"); netdev_err(dst->master_netdev,
"multiple cpu ports?!\n");
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -320,10 +321,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, ...@@ -320,10 +321,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]);
if (slave_dev == NULL) { if (slave_dev == NULL) {
printk(KERN_ERR "%s[%d]: can't create dsa " netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n",
"slave device for port %d(%s)\n", index, i, pd->port_names[i]);
dst->master_netdev->name,
index, i, pd->port_names[i]);
continue; continue;
} }
...@@ -701,15 +700,13 @@ static inline void dsa_of_remove(struct platform_device *pdev) ...@@ -701,15 +700,13 @@ static inline void dsa_of_remove(struct platform_device *pdev)
static int dsa_probe(struct platform_device *pdev) static int dsa_probe(struct platform_device *pdev)
{ {
static int dsa_version_printed;
struct dsa_platform_data *pd = pdev->dev.platform_data; struct dsa_platform_data *pd = pdev->dev.platform_data;
struct net_device *dev; struct net_device *dev;
struct dsa_switch_tree *dst; struct dsa_switch_tree *dst;
int i, ret; int i, ret;
if (!dsa_version_printed++) pr_notice_once("Distributed Switch Architecture driver version %s\n",
printk(KERN_NOTICE "Distributed Switch Architecture " dsa_driver_version);
"driver version %s\n", dsa_driver_version);
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
ret = dsa_of_probe(pdev); ret = dsa_of_probe(pdev);
...@@ -753,9 +750,8 @@ static int dsa_probe(struct platform_device *pdev) ...@@ -753,9 +750,8 @@ static int dsa_probe(struct platform_device *pdev)
ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev); ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev);
if (IS_ERR(ds)) { if (IS_ERR(ds)) {
printk(KERN_ERR "%s[%d]: couldn't create dsa switch " netdev_err(dev, "[%d]: couldn't create dsa switch instance (error %ld)\n",
"instance (error %ld)\n", dev->name, i, i, PTR_ERR(ds));
PTR_ERR(ds));
continue; continue;
} }
......
...@@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, ...@@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p,
*/ */
ret = of_phy_register_fixed_link(port_dn); ret = of_phy_register_fixed_link(port_dn);
if (ret) { if (ret) {
pr_err("failed to register fixed PHY\n"); netdev_err(slave_dev, "failed to register fixed PHY\n");
return; return;
} }
phy_is_fixed = true; phy_is_fixed = true;
...@@ -558,8 +558,8 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, ...@@ -558,8 +558,8 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p,
phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
p->phy_interface); p->phy_interface);
} else { } else {
pr_info("attached PHY at address %d [%s]\n", netdev_info(slave_dev, "attached PHY at address %d [%s]\n",
p->phy->addr, p->phy->drv->name); p->phy->addr, p->phy->drv->name);
} }
} }
...@@ -657,8 +657,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, ...@@ -657,8 +657,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
ret = register_netdev(slave_dev); ret = register_netdev(slave_dev);
if (ret) { if (ret) {
printk(KERN_ERR "%s: error %d registering interface %s\n", netdev_err(master, "error %d registering interface %s\n",
master->name, ret, slave_dev->name); ret, slave_dev->name);
free_netdev(slave_dev); free_netdev(slave_dev);
return NULL; return NULL;
} }
......
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