lkml.org 
[lkml]   [2006]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
Date

On Feb 26, 2006, at 2:38 PM, Dave Hansen wrote:

> On Fri, 2006-02-24 at 10:54 -0600, Kumar Gala wrote:
>> + if (strstr(cmd_line, "mem=")) {
>> + char *p, *q;
>> + unsigned long maxmem = 0;
>> +
>> + for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
>> + q = p + 4;
>> + if (p > cmd_line && p[-1] != ' ')
>> + continue;
>> + maxmem = simple_strtoul(q, &q, 0);
>> + if (*q == 'k' || *q == 'K') {
>> + maxmem <<= 10;
>> + ++q;
>> + } else if (*q == 'm' || *q == 'M') {
>> + maxmem <<= 20;
>> + ++q;
>> + } else if (*q == 'g' || *q == 'G') {
>> + maxmem <<= 30;
>> + ++q;
>> + }
>> + }
>> + memory_limit = maxmem;
>> + }
>
> You may want to check out lib/cmdline.c's memparse() function. I
> think
> it does this for you.

Yeah, found it after I sent the patch. Since Linus applied this
version, I'll provide Paul a version that changes this code to use
memparse for post 2.6.16.

- kumar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-27 17:15    [W:0.107 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site