All of lore.kernel.org
 help / color / mirror / Atom feed
From: holt@sgi.com (Robin Holt)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Date: Thu, 9 May 2013 06:29:16 -0500	[thread overview]
Message-ID: <20130509112916.GU3672@sgi.com> (raw)
In-Reply-To: <20130508135029.ffbeefa6b8154bee31e7bbbe@linux-foundation.org>

On Wed, May 08, 2013 at 01:50:29PM -0700, Andrew Morton wrote:
> On Tue,  7 May 2013 09:39:55 -0500 Robin Holt <holt@sgi.com> wrote:
> 
> > Merge together the unicore32, arm, and x86 reboot= command line
> > parameter handling.
> > 
> > ...
> >
> > +static int __init reboot_setup(char *str)
> > +{
> > +	for (;;) {
> > +		/*
> > +		 * Having anything passed on the command line via
> > +		 * reboot= will cause us to disable DMI checking
> > +		 * below.
> > +		 */
> > +		reboot_default = 0;
> > +
> > +		switch (*str) {
> > +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
> > +		case 'w':
> > +			reboot_mode = REBOOT_WARM;
> > +			break;
> > +
> > +		case 'c':
> > +			reboot_mode = REBOOT_COLD;
> > +			break;
> > +
> > +#ifdef CONFIG_SMP
> > +		case 's':
> > +			if (isdigit(*(str+1))) {
> > +				reboot_cpu = (int) (*(str+1) - '0');
> > +				if (isdigit(*(str+2)))
> > +					reboot_cpu = reboot_cpu*10 + (int)(*(str+2) - '0');
> > +			}
> 
> Boy, that's some weird stuff.
> 
> What's wrong with doing
> 
> 			if (isdigit(str[1])) {
> 				reboot_cpu = str[1] - '0';
> 				if (isdigit(str[2]))
> 					reboot_cpu = reboot_cpu * 10 +
> 							str[2] - '0';
> 			}
> 
> ?
> 
> But it's still nonsense - we should eliminate its
> you-have-less-than-101-CPUs restriction by using, you know, atoi().

I had an earlier version which I must have dropped which handled the
larger parsing, but I do like your suggestion of using atoi.  I will
submit a -v9 in a few hours.

Robin

WARNING: multiple messages have this Message-ID (diff)
From: Robin Holt <holt@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Robin Holt <holt@sgi.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Russell King <linux@arm.linux.org.uk>,
	Guan Xuetao <gxt@mprc.pku.edu.cn>, Russ Anderson <rja@sgi.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Date: Thu, 9 May 2013 06:29:16 -0500	[thread overview]
Message-ID: <20130509112916.GU3672@sgi.com> (raw)
In-Reply-To: <20130508135029.ffbeefa6b8154bee31e7bbbe@linux-foundation.org>

On Wed, May 08, 2013 at 01:50:29PM -0700, Andrew Morton wrote:
> On Tue,  7 May 2013 09:39:55 -0500 Robin Holt <holt@sgi.com> wrote:
> 
> > Merge together the unicore32, arm, and x86 reboot= command line
> > parameter handling.
> > 
> > ...
> >
> > +static int __init reboot_setup(char *str)
> > +{
> > +	for (;;) {
> > +		/*
> > +		 * Having anything passed on the command line via
> > +		 * reboot= will cause us to disable DMI checking
> > +		 * below.
> > +		 */
> > +		reboot_default = 0;
> > +
> > +		switch (*str) {
> > +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
> > +		case 'w':
> > +			reboot_mode = REBOOT_WARM;
> > +			break;
> > +
> > +		case 'c':
> > +			reboot_mode = REBOOT_COLD;
> > +			break;
> > +
> > +#ifdef CONFIG_SMP
> > +		case 's':
> > +			if (isdigit(*(str+1))) {
> > +				reboot_cpu = (int) (*(str+1) - '0');
> > +				if (isdigit(*(str+2)))
> > +					reboot_cpu = reboot_cpu*10 + (int)(*(str+2) - '0');
> > +			}
> 
> Boy, that's some weird stuff.
> 
> What's wrong with doing
> 
> 			if (isdigit(str[1])) {
> 				reboot_cpu = str[1] - '0';
> 				if (isdigit(str[2]))
> 					reboot_cpu = reboot_cpu * 10 +
> 							str[2] - '0';
> 			}
> 
> ?
> 
> But it's still nonsense - we should eliminate its
> you-have-less-than-101-CPUs restriction by using, you know, atoi().

I had an earlier version which I must have dropped which handled the
larger parsing, but I do like your suggestion of using atoi.  I will
submit a -v9 in a few hours.

Robin

  reply	other threads:[~2013-05-09 11:29 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 14:39 [PATCH -v8 00/11] Shutdown from reboot_cpuid without stopping other cpus Robin Holt
2013-05-07 14:39 ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-09 22:01   ` Andrew Morton
2013-05-09 22:01     ` Andrew Morton
2013-05-10 11:11     ` Rafael J. Wysocki
2013-05-10 11:11       ` Rafael J. Wysocki
2013-05-10 17:03       ` Andrew Morton
2013-05-10 17:03         ` Andrew Morton
2013-05-11  4:16         ` Robin Holt
2013-05-11  4:16           ` Robin Holt
2013-05-11  9:13           ` Srivatsa S. Bhat
2013-05-11  9:13             ` Srivatsa S. Bhat
2013-05-11  9:49             ` Robin Holt
2013-05-11  9:49               ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 02/11] Migrate shutdown/reboot to boot cpu Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 03/11] Remove -stable friendly PF_THREAD_BOUND define Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 04/11] Move shutdown/reboot related functions to kernel/reboot.c Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 05/11] checkpatch.pl the new kernel/reboot.c file Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 06/11] x86, prepare reboot_mode for moving to generic kernel code Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 07/11] unicore32, " Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 08/11] arm, Remove unused restart_mode fields from some arm subarchs Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 09/11] arm, prepare reboot_mode for moving to generic kernel code Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 10/11] arm, change reboot_mode to use enum reboot_mode Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-07 14:39 ` [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel Robin Holt
2013-05-07 14:39   ` Robin Holt
2013-05-08 10:39   ` Ingo Molnar
2013-05-08 10:39     ` Ingo Molnar
2013-05-08 18:20     ` Russell King - ARM Linux
2013-05-08 18:20       ` Russell King - ARM Linux
2013-05-08 18:33       ` H. Peter Anvin
2013-05-08 18:33         ` H. Peter Anvin
2013-05-09 11:20         ` Robin Holt
2013-05-09 11:20           ` Robin Holt
2013-05-09 13:01           ` Robin Holt
2013-05-09 13:01             ` Robin Holt
2013-05-09 13:36             ` Russell King - ARM Linux
2013-05-09 13:36               ` Russell King - ARM Linux
2013-05-09 15:59               ` Robin Holt
2013-05-09 15:59                 ` Robin Holt
2013-05-08 18:23   ` Russell King - ARM Linux
2013-05-08 18:23     ` Russell King - ARM Linux
2013-05-09 11:29     ` Robin Holt
2013-05-09 11:29       ` Robin Holt
2013-05-08 20:50   ` Andrew Morton
2013-05-08 20:50     ` Andrew Morton
2013-05-09 11:29     ` Robin Holt [this message]
2013-05-09 11:29       ` Robin Holt

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=20130509112916.GU3672@sgi.com \
    --to=holt@sgi.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.