mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	jbeulich@novell.com, tglx@linutronix.de,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/debug] x86: Combine printk()s in show_regs_common()
Date: Fri, 18 Feb 2011 12:19:46 -0800	[thread overview]
Message-ID: <1298060386.15565.25.camel@Joe-Laptop> (raw)
In-Reply-To: <20110218200528.GA4966@elte.hu>

On Fri, 2011-02-18 at 21:05 +0100, Ingo Molnar wrote:
> * Joe Perches <joe@perches.com> wrote:
> > Ingo, why did you choose to apply this patch instead of
> > the alternative one I posted on the same thread?
> Your version:
> 
> 	/* Board Name is optional */
> 	board = dmi_get_system_info(DMI_BOARD_NAME);
> 	if (!board)
> 		board = "";
> 
> 	printk(KERN_CONT "\n");
> 
> 	printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
> 	       current->pid, current->comm, print_tainted(),
> 	       init_utsname()->release,
> 	       (int)strcspn(init_utsname()->version, " "),
> 	       init_utsname()->version,
> 	       vendor, product,
> 	       strlen(board) ? "/" : "",
> 	       board);
> 
> The 'board' fiddling and the strlen(board) check complicates things unnecessarily 
> and makes the code hard to read. Jan's version was at least simple.

Perhaps you should look at the surrounding code.
It's uses the same style as I chose for "board".

void show_regs_common(void)
{
	const char *vendor, *product, *board;

	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
	if (!vendor)
		vendor = "";
	product = dmi_get_system_info(DMI_PRODUCT_NAME);
	if (!product)
		product = "";
...

> Something like this:
> 
> 	/* Board Name is optional */
> 	board = dmi_get_system_info(DMI_BOARD_NAME);
> 
> 	printk(KERN_CONT "\n");
> 
> 	printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s %s %s\n",
> 	       current->pid, current->comm, print_tainted(),
> 	       init_utsname()->release,
> 	       (int)strcspn(init_utsname()->version, " "),
> 	       init_utsname()->version,
> 	       vendor, product, board ? : "");
> 
> Would be easier to read and gives similarly useful output.

It's a question of using identical output or
merely similar output.

cheers, Joe


  reply	other threads:[~2011-02-18 20:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17 15:56 [PATCH] x86: combine " Jan Beulich
2011-02-17 18:53 ` Joe Perches
2011-02-18 10:40 ` [tip:x86/debug] x86: Combine " tip-bot for Jan Beulich
2011-02-18 19:41   ` Joe Perches
2011-02-18 20:05     ` Ingo Molnar
2011-02-18 20:19       ` Joe Perches [this message]
2011-02-18 21:15         ` Ingo Molnar

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=1298060386.15565.25.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome