public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Denis Vlasenko <vda.linux@googlemail.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>, Greg KH <greg@kroah.com>,
	Jesper Juhl <jesper.juhl@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Tiny error in printk output for clocksource : a3:<6>Time: acpi_pm clocksource has been installed.
Date: Thu, 28 Sep 2006 10:03:10 -0700	[thread overview]
Message-ID: <1159462990.5015.50.camel@localhost> (raw)
In-Reply-To: <200609281819.43712.vda.linux@googlemail.com>

On Thu, 2006-09-28 at 18:19 +0200, Denis Vlasenko wrote:
> You are trying to cover all possible cases with this monstrosity:
> extern char *__dev_addr6_fmt(char* buf, const unsigned char *addr);
> #define DEV_ADDR6_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
> #define DEV_ADDR6_BUF char __dev_addr6_buf[sizeof("FF:FF:FF:FF:FF:FF")]
> DEV_ADDR6_BUF;
> ...
> printk(", h/w address " DEV_ADDR6_FMT "\n", DEV_ADDR6(dev->dev_addr));

Yup, it's not pretty.

> Why don't you use a parameter for DEV_ADDR6{_BUF}? DEV_ADDR6_BUF(var_name).
> DEV_ADDR6(var_name, addr). That would be less cryptic.

Your idea makes code a bit visually longer, but I've no real objection.

> print_mac(", h/w address ", dev->dev_addr, "\n");

> > Would a patch with a DEV6_ADDR->EUI48 substitution
> > be acceptable?
> 
> Maybe. Doesn't look obvious, but if it is in standards...

Perhaps:

extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
#define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
#define DECLARE_EUI48(name) char name[sizeof("FF:FF:FF:FF:FF:FF")]
#define EUI48(name, addr) __EUI48_fmt(name, (const unsigned char *)addr)

use case:

{
	DECLARE_EUI48(eui48);
	printk("mac: " EUI48_FMT, EUI48(eui48, dev->dev_addr));
}

Here's one with an assumption of an eui48 buffer name.

extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
#define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
#define DECLARE_EUI48 char __eui48_buf[sizeof("FF:FF:FF:FF:FF:FF")]
#define EUI48(addr) __EUI48_fmt(__eui48_buf, (const unsigned char *)addr)

use case:

{
	DECLARE_EUI48;
	printk("mac: " EUI48_FMT, EUI48(dev->dev_addr));
}

Which one do you like more?


  reply	other threads:[~2006-09-28 17:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-27  0:22 Tiny error in printk output for clocksource : a3:<6>Time: acpi_pm clocksource has been installed Jesper Juhl
2006-09-27  0:33 ` Randy Dunlap
2006-09-27  0:36   ` Jesper Juhl
2006-09-27  0:54     ` Randy Dunlap
2006-09-27  1:15       ` Jesper Juhl
2006-09-27  3:54     ` Randy Dunlap
2006-09-27  4:32       ` Greg KH
2006-09-27  4:52         ` Randy Dunlap
2006-09-27  4:56           ` Randy Dunlap
2006-09-27  5:07             ` Greg KH
2006-09-27  5:10             ` Joe Perches
2006-09-27  5:17               ` Randy Dunlap
2006-09-27  5:19                 ` Joe Perches
2006-09-27 15:24                   ` Randy Dunlap
2006-09-28 10:56                 ` Denis Vlasenko
2006-09-28 16:08                   ` Joe Perches
2006-09-28 16:19                     ` Denis Vlasenko
2006-09-28 17:03                       ` Joe Perches [this message]
2006-09-28 23:26                       ` Joe Perches
2006-09-27 21:38       ` Jesper Juhl

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=1159462990.5015.50.camel@localhost \
    --to=joe@perches.com \
    --cc=greg@kroah.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=vda.linux@googlemail.com \
    /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