diff mbox

[3/8] macb: convert printk to pr_ and friends

Message ID 1299751843-9743-4-git-send-email-jamie@jamieiles.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Jamie Iles March 10, 2011, 10:10 a.m. UTC
macb is already using the dev_dbg() and friends helpers so use pr_foo()
along with a pr_fmt() definition to make the printing a little cleaner.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

Comments

Joe Perches March 10, 2011, 10:48 p.m. UTC | #1
On Thu, 2011-03-10 at 10:10 +0000, Jamie Iles wrote:
> macb is already using the dev_dbg() and friends helpers so use pr_foo()
> along with a pr_fmt() definition to make the printing a little cleaner.
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>

Hi Jamie.

Because these conversions use a struct net_device,
they would be better as:

	netdev_<foo>(struct net_device *dev, const char *fmt, ...)

> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> @@ -175,11 +176,11 @@ static void macb_handle_link_change(struct net_device *dev)
>  
>  	if (status_change) {
>  		if (phydev->link)
> -			printk(KERN_INFO "%s: link up (%d/%s)\n",
> +			pr_info("%s: link up (%d/%s)\n",
>  			       dev->name, phydev->speed,
>  			       DUPLEX_FULL == phydev->duplex ? "Full":"Half");

			netdev_info(dev, "link up (%d/%s)\n",
				    phydev->speed,
				    phydev->duplex == DUPLEX_FULL ? "Full" : "Half");
 
>  		else
> -			printk(KERN_INFO "%s: link down\n", dev->name);
> +			pr_info("%s: link down\n", dev->name);

			netdev_info(dev, "link down\n");

> @@ -193,7 +194,7 @@ static int macb_mii_probe(struct net_device *dev)
>  
>  	phydev = phy_find_first(bp->mii_bus);
>  	if (!phydev) {
> -		printk (KERN_ERR "%s: no PHY found\n", dev->name);
> +		pr_err("%s: no PHY found\n", dev->name);

		netdev_err(dev, "no PHY found\n");

> @@ -206,7 +207,7 @@ static int macb_mii_probe(struct net_device *dev)
>  				 PHY_INTERFACE_MODE_RMII :
>  				 PHY_INTERFACE_MODE_MII);
>  	if (ret) {
> -		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
> +		pr_err("%s: Could not attach to PHY\n", dev->name);

		netdev_err(dev, "could not attach to PHY\n");

etc...


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jamie Iles March 11, 2011, 12:09 a.m. UTC | #2
On Thu, Mar 10, 2011 at 02:48:04PM -0800, Joe Perches wrote:
> On Thu, 2011-03-10 at 10:10 +0000, Jamie Iles wrote:
> > macb is already using the dev_dbg() and friends helpers so use pr_foo()
> > along with a pr_fmt() definition to make the printing a little cleaner.
> > Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> 
> Hi Jamie.
> 
> Because these conversions use a struct net_device,
> they would be better as:
> 
> 	netdev_<foo>(struct net_device *dev, const char *fmt, ...)

Ahh nice, I hadn't come across those before.  I'll update all of the 
pr_* and dev_* statements to use the netdev variants.

Thanks for that!

Jamie
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jean-Christophe PLAGNIOL-VILLARD March 11, 2011, 12:53 p.m. UTC | #3
On 10:10 Thu 10 Mar     , Jamie Iles wrote:
> macb is already using the dev_dbg() and friends helpers so use pr_foo()
> along with a pr_fmt() definition to make the printing a little cleaner.
> 
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index ae98fee..5d676ad 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -8,6 +8,7 @@ 
  * published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) "macb: " fmt
 #include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -175,11 +176,11 @@  static void macb_handle_link_change(struct net_device *dev)
 
 	if (status_change) {
 		if (phydev->link)
-			printk(KERN_INFO "%s: link up (%d/%s)\n",
+			pr_info("%s: link up (%d/%s)\n",
 			       dev->name, phydev->speed,
 			       DUPLEX_FULL == phydev->duplex ? "Full":"Half");
 		else
-			printk(KERN_INFO "%s: link down\n", dev->name);
+			pr_info("%s: link down\n", dev->name);
 	}
 }
 
@@ -193,7 +194,7 @@  static int macb_mii_probe(struct net_device *dev)
 
 	phydev = phy_find_first(bp->mii_bus);
 	if (!phydev) {
-		printk (KERN_ERR "%s: no PHY found\n", dev->name);
+		pr_err("%s: no PHY found\n", dev->name);
 		return -1;
 	}
 
@@ -206,7 +207,7 @@  static int macb_mii_probe(struct net_device *dev)
 				 PHY_INTERFACE_MODE_RMII :
 				 PHY_INTERFACE_MODE_MII);
 	if (ret) {
-		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+		pr_err("%s: Could not attach to PHY\n", dev->name);
 		return ret;
 	}
 
@@ -303,7 +304,7 @@  static void macb_tx(struct macb *bp)
 
 	if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
 		int i;
-		printk(KERN_ERR "%s: TX %s, resetting buffers\n",
+		pr_err("%s: TX %s, resetting buffers\n",
 			bp->dev->name, status & MACB_BIT(UND) ?
 			"underrun" : "retry limit exceeded");
 
@@ -574,10 +575,11 @@  static irqreturn_t macb_interrupt(int irq, void *dev_id)
 
 		if (status & MACB_BIT(HRESP)) {
 			/*
-			 * TODO: Reset the hardware, and maybe move the printk
-			 * to a lower-priority context as well (work queue?)
+			 * TODO: Reset the hardware, and maybe move the
+			 * pr_err to a lower-priority context as well (work
+			 * queue?)
 			 */
-			printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n",
+			pr_err("%s: DMA bus error: HRESP not OK\n",
 			       dev->name);
 		}
 
@@ -950,9 +952,8 @@  static int macb_open(struct net_device *dev)
 
 	err = macb_alloc_consistent(bp);
 	if (err) {
-		printk(KERN_ERR
-		       "%s: Unable to allocate DMA memory (error %d)\n",
-		       dev->name, err);
+		pr_err("%s: Unable to allocate DMA memory (error %d)\n",
+			 dev->name, err);
 		return err;
 	}
 
@@ -1177,9 +1178,8 @@  static int __init macb_probe(struct platform_device *pdev)
 	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
 			  dev->name, dev);
 	if (err) {
-		printk(KERN_ERR
-		       "%s: Unable to request IRQ %d (error %d)\n",
-		       dev->name, dev->irq, err);
+		pr_err("%s: Unable to request IRQ %d (error %d)\n",
+			 dev->name, dev->irq, err);
 		goto err_out_iounmap;
 	}
 
@@ -1230,11 +1230,11 @@  static int __init macb_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n",
-	       dev->name, dev->base_addr, dev->irq, dev->dev_addr);
+	pr_info("%s: Atmel MACB at 0x%08lx irq %d (%pM)\n",
+		dev->name, dev->base_addr, dev->irq, dev->dev_addr);
 
 	phydev = bp->phy_dev;
-	printk(KERN_INFO "%s: attached PHY driver [%s] "
+	pr_info("%s: attached PHY driver [%s] "
 		"(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
 		phydev->drv->name, dev_name(&phydev->dev), phydev->irq);