mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kay Sievers <kay.sievers@vrfy.org>,
	Matthew Dharm <mdharm-usb@one-eyed-alien.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb <linux-usb@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: storage: Add usb_stor_dbg, reduce object size
Date: Thu, 18 Apr 2013 09:11:44 -0700	[thread overview]
Message-ID: <1366301504.2119.19.camel@joe-AO722> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1304181054340.1525-100000@iolanthe.rowland.org>

On Thu, 2013-04-18 at 10:57 -0400, Alan Stern wrote:
> On Wed, 17 Apr 2013, Joe Perches wrote:
> 
> > On Wed, 2013-04-17 at 14:47 -0400, Alan Stern wrote:
> > > On Wed, 17 Apr 2013, Joe Perches wrote:
> > []
> > > > +int usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
> > > > +{
> > > > +     struct va_format vaf;
> > > > +     va_list args;
> > > > +     int r;
> > > > +
> > > > +     va_start(args, fmt);
> > > > +
> > > > +     if (us && us->pusb_dev) {
> > > > +             r = dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args);
> > > 
> > > Isn't there a symbolic constant you can use instead of "7"?
> > 
> > Nope.
> > lib/dynamic_debug:__dynamic_dev_dbg() does the same thing.
> 
> This clearly is an omission in the logging API.
> 
> Kay, why doesn't the kernel have symbolic constants for the various
> logging facilities and levels?

Because they're so _very_ rarely used in decimal form.

printk.c, drivers/base/core.c, and net/core/dev.c
sensibly use - '0', and I think dynamic_debug is the
only other current user.

I suppose a new inline could be created something like

static inline int printk_get_level_decimal(const char *level)
{
	if (printk_get_level(level)) {
		switch (level[1]) {
			case '0' ... '7':
				return level[1] - '0';
		}
	}

	return -1;
}



  reply	other threads:[~2013-04-18 16:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17  5:44 Joe Perches
2013-04-17 14:14 ` Alan Stern
2013-04-17 14:39   ` Joe Perches
2013-04-17 15:06     ` Alan Stern
2013-04-17 17:17       ` Joe Perches
2013-04-17 18:47         ` Alan Stern
2013-04-18  0:18           ` Joe Perches
2013-04-18 14:57             ` Alan Stern
2013-04-18 16:11               ` Joe Perches [this message]
2013-04-18  3:00           ` [PATCH] usb: storage: Convert US_DEBUGP to usb_stor_dbg Joe Perches
2013-04-19 17:35             ` Greg Kroah-Hartman
2013-04-19 17:44               ` Joe Perches
2013-04-19 18:44               ` [PATCH V2] " Joe Perches
2013-04-22 19:35                 ` David Rientjes
2013-04-25 22:32                   ` Andrew Morton
2013-04-26  8:59                     ` David Rientjes

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=1366301504.2119.19.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®