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
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, · 21 unmodified lines
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, · 88 unmodified lines
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) · 371 unmodified lines
701 700
702static int dsa_probe(struct platform_device *pdev)701static 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) · 37 unmodified lines
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
net/dsa/slave.c+5−5
@@ -532,7 +532,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, · 531 unmodified lines
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, · 19 unmodified lines
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, · 91 unmodified lines
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 }