All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [trivial] arcnet: Correct incorrect format string in ARCnet drivers.
@ 2012-04-15 15:32 Steven Young
  2012-04-16 12:02 ` [PATCH] arcnet: rimi: Fix device name in debug output Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Young @ 2012-04-15 15:32 UTC (permalink / raw)
  To: trivial; +Cc: linux-kernel


  This patch corrects an incorrectly-used format string that causes messages
like:
  
  arc%d: Given: node 00h, shmem 0h, irq 0

  to appear in dmesg at boot/modprobe time for the arcnet-rimi driver and
others.  This applies to linux-3.3.

Signed-off-by: Steven Young <sdyoung@vt220.org>

---

--- linux-3.3-orig/drivers/net/arcnet/arcnet.c	2012-03-18 23:15:34.000000000 +0000
+++ linux-3.3/drivers/net/arcnet/arcnet.c	2012-04-15 15:50:24.000000000 +0100
@@ -346,7 +346,7 @@ struct net_device *alloc_arcdev(const ch
 	struct net_device *dev;
 
 	dev = alloc_netdev(sizeof(struct arcnet_local),
-			   name && *name ? name : "arc%d", arcdev_setup);
+			   name && *name ? name : "arcnet", arcdev_setup);
 	if(dev) {
 		struct arcnet_local *lp = netdev_priv(dev);
 		spin_lock_init(&lp->lock);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arcnet: rimi: Fix device name in debug output
  2012-04-15 15:32 [PATCH] [trivial] arcnet: Correct incorrect format string in ARCnet drivers Steven Young
@ 2012-04-16 12:02 ` Jiri Kosina
  2012-04-16 12:20   ` Steven Young
  2012-04-18  2:24   ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Kosina @ 2012-04-16 12:02 UTC (permalink / raw)
  To: Steven Young; +Cc: linux-kernel, David S. Miller, netdev

On Sun, 15 Apr 2012, Steven Young wrote:

> 
> This patch corrects an incorrectly-used format string that causes messages
> like:
>   
>   arc%d: Given: node 00h, shmem 0h, irq 0
> 
> to appear in dmesg at boot/modprobe time for the arcnet-rimi driver and
> others.  This applies to linux-3.3.
> 
> Signed-off-by: Steven Young <sdyoung@vt220.org>
> 
> ---
> 
> --- linux-3.3-orig/drivers/net/arcnet/arcnet.c	2012-03-18 23:15:34.000000000 +0000
> +++ linux-3.3/drivers/net/arcnet/arcnet.c	2012-04-15 15:50:24.000000000 +0100
> @@ -346,7 +346,7 @@ struct net_device *alloc_arcdev(const ch
>  	struct net_device *dev;
>  
>  	dev = alloc_netdev(sizeof(struct arcnet_local),
> -			   name && *name ? name : "arc%d", arcdev_setup);
> +			   name && *name ? name : "arcnet", arcdev_setup);
>  	if(dev) {
>  		struct arcnet_local *lp = netdev_priv(dev);
>  		spin_lock_init(&lp->lock);

I don't think this is correct. The only problem with you seeing the 
message above is that it's printed before register_netdev() happpens 
(which is where the resolution of the name in the formatstring happens).

But your change will alter the naming of the devices completely ....

I propose the minimalistic fix instead ... it'd be better to just drop the 
BUGMSG() thing altogether and convert it to dev_printk(), but that'd be 
larger revamp of the driver, and such effort is questionable for something 
like Arcnet :)

Adding proper CCs.




From: Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] arcnet: rimi: Fix device name in debug output

arcrimi_probe() calls BUGMSG() before register_netdev() happens. BUGMSG()
itself prints dev->name, but as the format string hasn't been expanded by
register_netdev() yet, the output contains bogus device name such as

	arc%d: Given: node 00h, shmem 0h, irq 0

As we don't know the device name yet, just drop the prefix completely from
the debugging messages.

Reported-by: Steven Young <sdyoung@vt220.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 drivers/net/arcnet/arc-rimi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index 25197b6..b8b4c7b 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -89,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev)
 	BUGLVL(D_NORMAL) printk(VERSION);
 	BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n");
 
-	BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n",
+	BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n",
 	       dev->dev_addr[0], dev->mem_start, dev->irq);
 
 	if (dev->mem_start <= 0 || dev->irq <= 0) {
-		BUGMSG(D_NORMAL, "No autoprobe for RIM I; you "
+		BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you "
 		       "must specify the shmem and irq!\n");
 		return -ENODEV;
 	}
 	if (dev->dev_addr[0] == 0) {
-		BUGMSG(D_NORMAL, "You need to specify your card's station "
+		BUGLVL(D_NORMAL) printk("You need to specify your card's station "
 		       "ID!\n");
 		return -ENODEV;
 	}
@@ -109,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev)
 	 * will be taken.
 	 */
 	if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) {
-		BUGMSG(D_NORMAL, "Card memory already allocated\n");
+		BUGLVL(D_NORMAL) printk("Card memory already allocated\n");
 		return -ENODEV;
 	}
 	return arcrimi_found(dev);

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arcnet: rimi: Fix device name in debug output
  2012-04-16 12:02 ` [PATCH] arcnet: rimi: Fix device name in debug output Jiri Kosina
@ 2012-04-16 12:20   ` Steven Young
  2012-04-18  2:24   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Young @ 2012-04-16 12:20 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel, David S. Miller, netdev

On Mon, Apr 16, 2012 at 02:02:48PM +0200, Jiri Kosina wrote:
> I propose the minimalistic fix instead ... it'd be better to just drop the 
> BUGMSG() thing altogether and convert it to dev_printk(), but that'd be 
> larger revamp of the driver, and such effort is questionable for something 
> like Arcnet :)

  You're right, I'm not really interested in spending any amount of time on
ARCnet.  It's just something I noticed when I was booting a poorly-configured
kernel and thought I'd try a drive-by fix. :)

  Thanks for your time,
  Steve.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arcnet: rimi: Fix device name in debug output
  2012-04-16 12:02 ` [PATCH] arcnet: rimi: Fix device name in debug output Jiri Kosina
  2012-04-16 12:20   ` Steven Young
@ 2012-04-18  2:24   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-04-18  2:24 UTC (permalink / raw)
  To: jkosina; +Cc: sdyoung, linux-kernel, netdev

From: Jiri Kosina <jkosina@suse.cz>
Date: Mon, 16 Apr 2012 14:02:48 +0200 (CEST)

> From: Jiri Kosina <jkosina@suse.cz>
> Subject: [PATCH] arcnet: rimi: Fix device name in debug output
> 
> arcrimi_probe() calls BUGMSG() before register_netdev() happens. BUGMSG()
> itself prints dev->name, but as the format string hasn't been expanded by
> register_netdev() yet, the output contains bogus device name such as
> 
> 	arc%d: Given: node 00h, shmem 0h, irq 0
> 
> As we don't know the device name yet, just drop the prefix completely from
> the debugging messages.
> 
> Reported-by: Steven Young <sdyoung@vt220.org>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-18  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15 15:32 [PATCH] [trivial] arcnet: Correct incorrect format string in ARCnet drivers Steven Young
2012-04-16 12:02 ` [PATCH] arcnet: rimi: Fix device name in debug output Jiri Kosina
2012-04-16 12:20   ` Steven Young
2012-04-18  2:24   ` David Miller

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.