public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Szymon Janc <szymon@janc.net.pl>, netdev@vger.kernel.org
Subject: Re: [PATCH 5/6] forcedeth: use KERN_ facility level in printk
Date: Sat, 27 Nov 2010 11:45:40 -0800	[thread overview]
Message-ID: <1290887140.22971.16.camel@Joe-Laptop> (raw)
In-Reply-To: <1290884641.3292.0.camel@localhost>

On Sat, 2010-11-27 at 19:04 +0000, Ben Hutchings wrote:
> On Sat, 2010-11-27 at 19:39 +0100, Szymon Janc wrote:
> > diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
> > index 2f092d7..a2b6681 100644
> > --- a/drivers/net/forcedeth.c
> > +++ b/drivers/net/forcedeth.c
> > @@ -958,7 +958,7 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
> >  		delaymax -= delay;
> >  		if (delaymax < 0) {
> >  			if (msg)
> > -				printk("%s", msg);
> > +				printk(KERN_WARNING "%s", msg);
> No, msg already includes a log level.

True.  The messages are still broken though.
Some have trailing newlines, others not.

It'd be better to move the msg after the reg_delay
call and add the missing newlines.

---

 drivers/net/forcedeth.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 0fa1776..2d11028f 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -948,7 +948,7 @@ static bool nv_optimized(struct fe_priv *np)
 }
 
 static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
-				int delay, int delaymax, const char *msg)
+				int delay, int delaymax)
 {
 	u8 __iomem *base = get_hwbase(dev);
 
@@ -956,11 +956,8 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
 	do {
 		udelay(delay);
 		delaymax -= delay;
-		if (delaymax < 0) {
-			if (msg)
-				printk("%s", msg);
+		if (delaymax < 0)
 			return 1;
-		}
 	} while ((readl(base + offset) & mask) != target);
 	return 0;
 }
@@ -1145,7 +1142,7 @@ static int mii_rw(struct net_device *dev, int addr, int miireg, int value)
 	writel(reg, base + NvRegMIIControl);
 
 	if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0,
-			NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) {
+			NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX)) {
 		dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n",
 				dev->name, miireg, addr);
 		retval = -1;
@@ -1547,9 +1544,9 @@ static void nv_stop_rx(struct net_device *dev)
 	else
 		rx_ctrl |= NVREG_RCVCTL_RX_PATH_EN;
 	writel(rx_ctrl, base + NvRegReceiverControl);
-	reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0,
-			NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX,
-			KERN_INFO "nv_stop_rx: ReceiverStatus remained busy");
+	if (reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0,
+		      NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX))
+		printk(KERN_INFO "nv_stop_rx: ReceiverStatus remained busy\n");
 
 	udelay(NV_RXSTOP_DELAY2);
 	if (!np->mac_in_use)
@@ -1582,9 +1579,9 @@ static void nv_stop_tx(struct net_device *dev)
 	else
 		tx_ctrl |= NVREG_XMITCTL_TX_PATH_EN;
 	writel(tx_ctrl, base + NvRegTransmitterControl);
-	reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0,
-			NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX,
-			KERN_INFO "nv_stop_tx: TransmitterStatus remained busy");
+	if (reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0,
+		      NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX))
+	    printk(KERN_INFO "nv_stop_tx: TransmitterStatus remained busy\n");
 
 	udelay(NV_TXSTOP_DELAY2);
 	if (!np->mac_in_use)
@@ -5216,9 +5213,10 @@ static int nv_open(struct net_device *dev)
 	writel(np->vlanctl_bits, base + NvRegVlanControl);
 	pci_push(base);
 	writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl);
-	reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31,
-			NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX,
-			KERN_INFO "open: SetupReg5, Bit 31 remained off\n");
+	if (reg_delay(dev, NvRegUnknownSetupReg5,
+		      NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31,
+		      NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX))
+	    printk(KERN_INFO "open: SetupReg5, Bit 31 remained off\n");
 
 	writel(0, base + NvRegMIIMask);
 	writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);



  reply	other threads:[~2010-11-27 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-27 18:39 [PATCH 0/6] Forcedeth code style cleanup Szymon Janc
2010-11-27 18:39 ` [PATCH 1/6] forcedeth: fix multiple code style issues Szymon Janc
2010-11-27 18:39 ` [PATCH 2/6] forcedeth: remove unnecessary checks before kfree Szymon Janc
2010-11-27 18:39 ` [PATCH 3/6] forcedeth: include <linux/io.h> and <linux/uaccess.h> instead of <asm/io.h> and <asm/uaccess.h> as suggested by checkpatch Szymon Janc
2010-11-27 18:39 ` [PATCH 4/6] forcedeth: do not use assignment in if conditions Szymon Janc
2010-11-27 18:39 ` [PATCH 5/6] forcedeth: use KERN_ facility level in printk Szymon Janc
2010-11-27 19:04   ` Ben Hutchings
2010-11-27 19:45     ` Joe Perches [this message]
2010-11-28  9:05       ` Michał Mirosław
2010-11-28  9:11         ` Joe Perches
2010-11-27 18:39 ` [PATCH 6/6] forcedeth: use usleep_range not msleep for small sleeps Szymon Janc
2010-11-29  2:07 ` [PATCH 0/6] Forcedeth code style cleanup David Miller

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=1290887140.22971.16.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=bhutchings@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=szymon@janc.net.pl \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox