History

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.

Joe Perches committed 12 years ago

Commit a2ae6001 parent 008e8162 files · +17 −21Browse files

Unified · Split

2 files
  1. net/dsa/dsa.c +12 −16
  2. net/dsa/slave.c +5 −5
net/dsa/dsa.c+12−16
@@ -192,12 +192,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 191 unmodified lines
192192 */
193193 drv = dsa_switch_probe(host_dev, pd->sw_addr, &name);
194194 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);
197197 return ERR_PTR(-EINVAL);
198198 }
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);
201201
202202
203203 /*
@@ -225,7 +225,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 21 unmodified lines
225225
226226 if (!strcmp(name, "cpu")) {
227227 if (dst->cpu_switch != -1) {
228− printk(KERN_ERR "multiple cpu ports?!\n");
228+ netdev_err(dst->master_netdev,
229+ "multiple cpu ports?!\n");
229230 ret = -EINVAL;
230231 goto out;
231232 }
@@ -320,10 +321,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 88 unmodified lines
320321
321322 slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]);
322323 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]);
327326 continue;
328327 }
329328
@@ -701,15 +700,13 @@ static inline void dsa_of_remove(struct platform_device *pdev) · 371 unmodified lines
701700
702701 static int dsa_probe(struct platform_device *pdev)
703702 {
704− static int dsa_version_printed;
705703 struct dsa_platform_data *pd = pdev->dev.platform_data;
706704 struct net_device *dev;
707705 struct dsa_switch_tree *dst;
708706 int i, ret;
709707
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);
713710
714711 if (pdev->dev.of_node) {
715712 ret = dsa_of_probe(pdev);
@@ -753,9 +750,8 @@ static int dsa_probe(struct platform_device *pdev) · 37 unmodified lines
753750
754751 ds = dsa_switch_setup(dst, i, &pdev->dev, pd->chip[i].host_dev);
755752 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));
759755 continue;
760756 }
761757
net/dsa/slave.c+5−5
@@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, · 531 unmodified lines
532532 */
533533 ret = of_phy_register_fixed_link(port_dn);
534534 if (ret) {
535− pr_err("failed to register fixed PHY\n");
535+ netdev_err(slave_dev, "failed to register fixed PHY\n");
536536 return;
537537 }
538538 phy_is_fixed = true;
@@ -558,8 +558,8 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, · 19 unmodified lines
558558 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
559559 p->phy_interface);
560560 } 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);
563563 }
564564 }
565565
@@ -657,8 +657,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, · 91 unmodified lines
657657
658658 ret = register_netdev(slave_dev);
659659 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);
662662 free_netdev(slave_dev);
663663 return NULL;
664664 }