From: Joe Perches <joe@perches.com>
To: Jamie Iles <jamie@jamieiles.com>
Cc: netdev@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCHv4 4/9] macb: convert printk to netdev_ and friends
Date: Wed, 09 Nov 2011 05:10:47 -0800 [thread overview]
Message-ID: <1320844247.6923.18.camel@Joe-Laptop> (raw)
In-Reply-To: <1320761613-18641-5-git-send-email-jamie@jamieiles.com>
On Tue, 2011-11-08 at 14:13 +0000, Jamie Iles wrote:
> macb is already using the dev_dbg() and friends helpers so use netdev_()
> along with a pr_fmt() definition to make the printing a little cleaner.
trivia...
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
[]
> @@ -8,6 +8,7 @@
> * published by the Free Software Foundation.
> */
>
> +#define pr_fmt(fmt) "macb: " fmt
I think this is better as
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> @@ -176,11 +177,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",
> - dev->name, phydev->speed,
> - DUPLEX_FULL == phydev->duplex ? "Full":"Half");
> + netdev_info(dev, "link up (%d/%s)\n", phydev->speed,
> + DUPLEX_FULL == phydev->duplex ?
> + "Full" : "Half");
Couple of very trivial style things here.
I think this is better as var == const and I also try
to keep arguments on a single line where possible and
when not possible, more arguments after the format to
seoarate lines.
netdev_info(dev, "link up (%d/%s)\n",
phydev->speed,
phydev->duplex == DUPLEX_FULL ?
"Full" : "Half");
[]
> @@ -625,12 +624,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
>
> #ifdef DEBUG
> int i;
> - dev_dbg(&bp->pdev->dev,
> - "start_xmit: len %u head %p data %p tail %p end %p\n",
> - skb->len, skb->head, skb->data,
> - skb_tail_pointer(skb), skb_end_pointer(skb));
> - dev_dbg(&bp->pdev->dev,
> - "data:");
> + netdev_dbg(bp->dev,
> + "start_xmit: len %u head %p data %p tail %p end %p\n",
> + skb->len, skb->head, skb->data,
> + skb_tail_pointer(skb), skb_end_pointer(skb));
> + netdev_dbg(bp->dev, "data:");
> for (i = 0; i < 16; i++)
> printk(" %02x", (unsigned int)skb->data[i]);
> printk("\n");
Maybe print_hex_dump
> @@ -1228,13 +1223,13 @@ 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);
> + netdev_info(dev, "Atmel MACB at 0x%08lx irq %d (%pM)\n",
> + dev->base_addr, dev->irq, dev->dev_addr);
>
> phydev = bp->phy_dev;
> - printk(KERN_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);
> + netdev_info(dev, "attached PHY driver [%s] "
> + "(mii_bus:phy_addr=%s, irq=%d)\n", phydev->drv->name,
> + dev_name(&phydev->dev), phydev->irq);
Coalescing formats can also be done to make
it slightly easier to grep.
netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
next prev parent reply other threads:[~2011-11-09 13:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 14:13 [PATCHv4 0/9] macb: add support for Cadence GEM Jamie Iles
2011-11-08 14:13 ` [PATCHv4 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
2011-11-08 14:13 ` [PATCHv4 2/9] macb: remove conditional clk handling Jamie Iles
2011-11-08 14:13 ` [PATCHv4 3/9] macb: unify at91 and avr32 platform data Jamie Iles
2011-11-08 14:13 ` [PATCHv4 4/9] macb: convert printk to netdev_ and friends Jamie Iles
2011-11-09 13:10 ` Joe Perches [this message]
2011-11-09 13:14 ` Jamie Iles
2011-11-09 13:37 ` Jamie Iles
2011-11-09 13:46 ` Joe Perches
2011-11-09 13:55 ` Jamie Iles
2011-11-08 14:13 ` [PATCHv4 5/9] macb: initial support for Cadence GEM Jamie Iles
2011-11-08 14:13 ` [PATCHv4 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles
2011-11-08 14:13 ` [PATCHv4 7/9] macb: support statistics for GEM devices Jamie Iles
2011-11-08 14:13 ` [PATCHv4 8/9] macb: support DMA bus widths > 32 bits Jamie Iles
2011-11-08 14:13 ` [PATCHv4 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320844247.6923.18.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=arnd@arndb.de \
--cc=jamie@jamieiles.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.