All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Cohen <david.a.cohen@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Alan Cox <alan@linux.intel.com>,
	"Stuart R. Anderson" <stuart.r.anderson@intel.com>,
	Joe Perches <joe@perches.com>
Subject: Re: [RFC][PATCH] x86: Allow early_printk to use console style param like 115200n8
Date: Mon, 06 Jul 2015 09:29:58 -0400	[thread overview]
Message-ID: <559A82D6.5040007@hurleysoftware.com> (raw)
In-Reply-To: <20150704092000.322dc4e6@grimm.local.home>

On 07/04/2015 09:20 AM, Steven Rostedt wrote:
> On Sat, 4 Jul 2015 13:03:59 +0200
> Ingo Molnar <mingo@kernel.org> wrote:
> 
> 
>>> +		/*
>>> +		 * In case the input is like console with text after the baud
>>> +		 * rate. e.g. 115200n8. kstrtoul() will error on such input.
>>> +		 */
>>> +		for (p = s; *p && isdigit(*p); p++)
>>> +			;
>>> +		*p = 0;
>>> +
>>>  		if (kstrtoul(s, 0, &baud) < 0 || baud == 0)
>>>  			baud = DEFAULT_BAUD;
>>
>>
> 
> This was actually one of those cases where I wanted to show that
> keeping the old function around is better than the alternative ;-)
> 
> If people say we need to phase out simple_strtoull(), then I wanted to
> show what kinds of hacks we will have if that happens.
> 
> I was hoping that someone would point out that simple_strtoull() is a
> better solution. :)

And made worse by the fact that checkpatch flags simple_strtoul* as
obsolete, so people keep submitting junk like above [1] in an effort to
escape the checkpatch warning.

Which I pointed out to Joe back in Feb. (https://lkml.org/lkml/2015/2/25/217)

Regards,
Peter Hurley

[1] or this recent submission

On 05/26/2015 01:12 PM, Peter Hurley wrote:
> On 05/22/2015 12:06 PM, Bin Gao wrote:
>
>> +{
>> +	char str[4]; /* max 3 chars, plus a NULL terminator */
>> +	char *p = options;
>> +	int i = 0;
>> +
>> +	while (*p) {
>> +		if (i >= 4)
>> +			return -EINVAL;
>> +
>> +		if (*p == delimiter) {
>> +			str[i++] = 0;
>> +			if (endp)
>> +				*endp = p + 1;
>> +			return kstrtou8(str, 10, val); /* decimal, no hex */
>> +		}
>> +
>> +		str[i++] = *p++;
>> +	}
> 
> Is all this to avoid using simple_strtoul()?
> If yes, I'd rather you use simple_strtoul() like the rest of the console
> code and ignore the (misguided) advice that simple_strtoul() is obsolete.


  parent reply	other threads:[~2015-07-06 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 22:16 [RFC][PATCH] x86: Allow early_printk to use console style param like 115200n8 Steven Rostedt
2015-07-04 11:03 ` Ingo Molnar
2015-07-04 13:16   ` Steven Rostedt
2015-07-04 13:20   ` Steven Rostedt
2015-07-05  9:05     ` Ingo Molnar
2015-07-06 13:29     ` Peter Hurley [this message]
2015-07-06 13:33       ` Ingo Molnar
2015-07-06 14:14 ` [PATCH] " Steven Rostedt
2015-07-06 16:34   ` [tip:x86/urgent] x86/earlyprintk: Allow early_printk() to use console style parameters like '115200n8' tip-bot for Steven Rostedt

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=559A82D6.5040007@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=alan@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stuart.r.anderson@intel.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 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.