netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>,
	David Brownell <david-b@pacbell.net>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] usbnet: Convert dev(dbg|err|warn|info) macros to netdev_<level>
Date: Mon, 15 Feb 2010 01:17:46 +0100	[thread overview]
Message-ID: <4B7892AA.7000305@imap.cc> (raw)
In-Reply-To: <ec60c0152394dbca309a66072035b92342d8bf7b.1266187670.git.joe@perches.com>

[-- Attachment #1: Type: text/plain, Size: 4876 bytes --]

Am 15.02.2010 00:01 schrieb Joe Perches:
> Some logging messages were in the form:
> 
> 	printk(KERN_<level> "msg %s%s%s%s\n",
> 	       value == 1 ? "one" : "",
> 	       value == 2 ? "two" : "",
> 	       value == 3 ? "three" : "",
> 	       value == 4 ? "four" : "unknown");
> 
> Converted to:
> 
> 	printk(KERN_<level> "msg %s\n",
> 	       value == 1 ? "one" :
> 	       value == 2 ? "two" :
> 	       value == 3 ? "three" :
> 	       value == 4 ? "four" : "unknown");
[...]
> diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
> index aeb1ab0..aa078f3 100644
> --- a/drivers/net/usb/net1080.c
> +++ b/drivers/net/usb/net1080.c
> @@ -205,23 +205,24 @@ static inline void nc_dump_usbctl(struct usbnet *dev, u16 usbctl)
>  {
>  	if (!netif_msg_link(dev))
>  		return;
> -	devdbg(dev, "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s;"
> -			" this%s%s;"
> -			" other%s%s; r/o 0x%x",
> -		dev->udev->bus->bus_name, dev->udev->devpath,
> -		usbctl,
> -		(usbctl & USBCTL_ENABLE_LANG) ? " lang" : "",
> -		(usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "",
> -		(usbctl & USBCTL_ENABLE_PROD) ? " prod" : "",
> -		(usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "",
> -		(usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "",
> -
> -		(usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "",
> -		(usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "",
> -		(usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "",
> -		(usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "",
> -		usbctl & ~USBCTL_WRITABLE_MASK
> -		);
> +	netdev_dbg(dev->net, "net1080 %s-%s usbctl 0x%x:%s;"
> +		   " this%s;"
> +		   " other%s; r/o 0x%x\n",
> +		   dev->udev->bus->bus_name, dev->udev->devpath,
> +		   usbctl,
> +		   (usbctl & USBCTL_ENABLE_LANG) ? " lang" :
> +		   (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" :
> +		   (usbctl & USBCTL_ENABLE_PROD) ? " prod" :
> +		   (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" :
> +		   (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "",
> +
> +		   (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" :
> +		   (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "",
> +
> +		   (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" :
> +		   (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "",
> +
> +		   usbctl & ~USBCTL_WRITABLE_MASK);
>  }
>  
>  /*-------------------------------------------------------------------------*/

That doesn't look right. The original code concatenates all the strings
corresponding to the set bits in usbctl. With your patch, it prints only
the string corresponding to the first set bit it encounters within each
group. Eg. with USBCTL_FLUSH_OTHER and USBCTL_DISCONN_OTHER both set,
the original code would print "this FLUSH DIS", while your version would
only print "this FLUSH".

Btw, is it intentional that the _OTHER values are printed after the
label "this", and the _THIS values after the label "other"?

> @@ -250,28 +251,25 @@ static inline void nc_dump_status(struct usbnet *dev, u16 status)
>  {
>  	if (!netif_msg_link(dev))
>  		return;
> -	devdbg(dev, "net1080 %s-%s status 0x%x:"
> -			" this (%c) PKT=%d%s%s%s;"
> -			" other PKT=%d%s%s%s; unspec 0x%x",
> -		dev->udev->bus->bus_name, dev->udev->devpath,
> -		status,
> -
> -		// XXX the packet counts don't seem right
> -		// (1 at reset, not 0); maybe UNSPEC too
> -
> -		(status & STATUS_PORT_A) ? 'A' : 'B',
> -		STATUS_PACKETS_THIS(status),
> -		(status & STATUS_CONN_THIS) ? " CON" : "",
> -		(status & STATUS_SUSPEND_THIS) ? " SUS" : "",
> -		(status & STATUS_MAILBOX_THIS) ? " MBOX" : "",
> -
> -		STATUS_PACKETS_OTHER(status),
> -		(status & STATUS_CONN_OTHER) ? " CON" : "",
> -		(status & STATUS_SUSPEND_OTHER) ? " SUS" : "",
> -		(status & STATUS_MAILBOX_OTHER) ? " MBOX" : "",
> -
> -		status & STATUS_UNSPEC_MASK
> -		);
> +	netdev_dbg(dev->net, "net1080 %s-%s status 0x%x: this (%c) PKT=%d%s; other PKT=%d%s; unspec 0x%x\n",
> +		   dev->udev->bus->bus_name, dev->udev->devpath,
> +		   status,
> +
> +		   // XXX the packet counts don't seem right
> +		   // (1 at reset, not 0); maybe UNSPEC too
> +
> +		   (status & STATUS_PORT_A) ? 'A' : 'B',
> +		   STATUS_PACKETS_THIS(status),
> +		   (status & STATUS_CONN_THIS) ? " CON" :
> +		   (status & STATUS_SUSPEND_THIS) ? " SUS" :
> +		   (status & STATUS_MAILBOX_THIS) ? " MBOX" : "",
> +
> +		   STATUS_PACKETS_OTHER(status),
> +		   (status & STATUS_CONN_OTHER) ? " CON" :
> +		   (status & STATUS_SUSPEND_OTHER) ? " SUS" :
> +		   (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "",
> +
> +		   status & STATUS_UNSPEC_MASK);
>  }
>  
>  /*-------------------------------------------------------------------------*/

Same problem.

HTH
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2010-02-15  0:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  1:43 [PATCH] usbnet: convert dev(dbg|err|warn|info) macros to usbnet_(dbg|err|warn|info) Joe Perches
     [not found] ` <3d8577211d88cce1fb6f4c1b54c5aa413a1f325a.1265765892.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2010-02-10  5:53   ` David Brownell
2010-02-10  6:16     ` Joe Perches
     [not found]       ` <1265782578.20626.17.camel-AkRN8/LKpobuYGix6ZUp1Q@public.gmane.org>
2010-02-10  6:56         ` David Brownell
2010-02-12 20:38           ` David Miller
     [not found]             ` <20100212.123837.56526847.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-02-14 23:01               ` [net-next PATCH 0/2] usbnet: convert dev(dbg|err|warn|info) macros to netdev_<> Joe Perches
2010-02-14 23:01                 ` [PATCH 1/2] usbnet: Convert dev(dbg|err|warn|info) macros to netdev_<level> Joe Perches
2010-02-15  0:17                   ` Tilman Schmidt [this message]
2010-02-15  0:54                     ` Joe Perches
     [not found]                       ` <1266195287.16721.953.camel-AkRN8/LKpobuYGix6ZUp1Q@public.gmane.org>
2010-02-15  3:09                         ` David Brownell
2010-02-14 23:01                 ` [PATCH 2/2] drivers/net/usb: Use netif_<level> logging facilities Joe Perches
2010-02-15  8:25             ` [PATCH V2 net-next 1/2] usbnet: Convert dev(dbg|err|warn|info) macros to netdev_<level> Joe Perches
2010-02-17  7:37               ` David Miller
2010-02-17  8:04                 ` David Miller
     [not found]                   ` <20100217.000422.246530855.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-02-17 20:30                     ` [PATCH V3 net-next 0/2] usbnet: Use (netdev|netif)_<level> macros Joe Perches
2010-02-17 20:30                       ` [PATCH V3 net-next 1/2] usbnet: Convert dev(dbg|err|warn|info) macros to netdev_<level> Joe Perches
2010-02-17 20:30                       ` [PATCH V3 net-next 2/2] drivers/net/usb: Use netif_<level> logging facilities Joe Perches
2010-02-17 21:38                       ` [PATCH V3 net-next 0/2] usbnet: Use (netdev|netif)_<level> macros David Miller
2010-02-17 21:44                         ` Joe Perches
2010-02-17 21:54                           ` David Miller
2010-02-15  8:25             ` [PATCH V2 net-next 2/2] drivers/net/usb: Use netif_<level> logging facilities Joe Perches
2010-02-17  7:37               ` 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=4B7892AA.7000305@imap.cc \
    --to=tilman@imap.cc \
    --cc=davem@davemloft.net \
    --cc=david-b@pacbell.net \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).