public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marco Stornelli <marco.stornelli@coritel.it>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Linux AVR32 <kernel@avr32linux.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] avr32: added mem kernel command line option support
Date: Tue, 16 Sep 2008 09:14:03 +0200	[thread overview]
Message-ID: <48CF5CBB.1050708@coritel.it> (raw)
In-Reply-To: <20080915083622.062c4b5b.randy.dunlap@oracle.com>

From: Marco Stornelli <marco.stornelli@gmail.com>

Now is it ok? Sorry but it's the first time I submit a patch for the kernel.
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
--- linux-2.6.26.3/arch/avr32/kernel/setup.c.orig	2008-09-15
11:30:00.000000000 +0200
+++ linux-2.6.26.3/arch/avr32/kernel/setup.c	2008-09-16
09:06:31.000000000 +0200
@@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char
 }
 early_param("fbmem", early_parse_fbmem);

+/*
+ * Pick out the memory size.  We look for mem=size@start,
+ * where start and size are "size[KkMmGg]"
+ */
+static int __init early_mem(char *p)
+{
+	resource_size_t size, start;
+
+	start = system_ram->start;
+	size  = memparse(p, &p);
+	if (*p == '@')
+		start = memparse(p + 1, &p);
+
+	system_ram->start = start;
+	system_ram->end = system_ram->start + size - 1;
+	return 0;
+}
+early_param("mem", early_mem);
+
 static int __init parse_tag_core(struct tag *tag)
 {
 	if (tag->hdr.size > 2) {


Randy Dunlap ha scritto:
> On Mon, 15 Sep 2008 17:30:48 +0200 Marco Stornelli wrote:
> 
>> From: Marco Stornelli <marco.stornelli@gmail.com>
>>
>> Fixed the type of size and start, now they are resource_size_t.
>> Fixed the double pointer parameter, now it's only a single pointer.
>> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
>> ---
>> --- linux-2.6.26.5/arch/avr32/kernel/setup.c.orig    2008-09-15 11:30:00.000000000 +0200
>>
>> +++ linux-2.6.26.5/arch/avr32/kernel/setup.c 2008-09-15
>> 11:30:17.000000000 +0200
>> @@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char
>> }
>> early_param("fbmem", early_parse_fbmem);
>>
>> +/*
>> + * Pick out the memory size. We look for mem=size@start,
>> + * where start and size are "size[KkMmGg]"
>> + */
>> +static int __init early_mem(char *p)
>> +{
>> + resource_size_t size, start;
>> +
>> + start = system_ram->start;
>> + size = memparse(p, &p);
>> + if (**p == '@')
>> + start = memparse(p + 1, &p);
> 
> Lots of whitespace damage here.  Your first patch looked OK
> for whitespace, so something changed....
> 
> 
>> +
>> + system_ram->start = start;
>> + system_ram->end = system_ram->start + size - 1;
>> + return 0;
>> +}
>> +early_param("mem", early_mem);
>> +
>> static int __init parse_tag_core(struct tag *tag)
>> {
>> if (tag->hdr.size > 2) {
>>
>> Randy Dunlap ha scritto:
>>> On Mon, 15 Sep 2008 16:57:10 +0200 Marco Stornelli wrote:
>>>
>>>   
>>>> If you see the above function early_parse_fbmem:
>>>>
>>>> static int __init early_parse_fbmem(char *p)
>>>> {
>>>> int ret;
>>>> unsigned long align;
>>>>
>>>> fbmem_size = memparse(p, &p);
>>>> .........
>>>>
>>>> where fbmem_size is a resource_size_t (u32 because avr32 is a 32-bit
>>>> architecture), so I used the same philosophy. Maybe I can remove
>>>> unsigned long and replace it with resource_size_t to be more uniform.
>>>>     
>>> Yes, I think that would be better.
>>>
>>> Thanks.
>>>
>>>   
>>>> Randy Dunlap ha scritto:
>>>>     
>>>>> On Mon, 15 Sep 2008 12:07:19 +0200 Marco Stornelli wrote:
>>>>>
>>>>>   
>>>>>       
>>>>>> From: Marco Stornelli <marco.stornelli@gmail.com>
>>>>>>
>>>>>> Added support for the mem kernel command line option
>>>>>> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
>>>>>> ---
>>>>>> --- setup.c.orig    2008-09-15 11:30:00.000000000 +0200
>>>>>> +++ setup.c    2008-09-15 11:30:17.000000000 +0200
>>>>>> @@ -283,6 +283,25 @@ static int __init early_parse_fbmem(char
>>>>>>  }
>>>>>>  early_param("fbmem", early_parse_fbmem);
>>>>>>  
>>>>>> +/*
>>>>>> + * Pick out the memory size.  We look for mem=size@start,
>>>>>> + * where start and size are "size[KkMm]"
>>>>>>     
>>>>>>         
>>>>>                                     [KkMmGg]
>>>>>
>>>>>   
>>>>>       
>>>>>> + */
>>>>>> +static int __init early_mem(char **p)
>>>>>> +{
>>>>>> +    unsigned long size, start;
>>>>>> +
>>>>>> +    start = system_ram->start;
>>>>>> +    size  = memparse(*p, p);
>>>>>>     
>>>>>>         
>>>>> memparse() returns an unsigned long long.  Is the truncation OK for avr32?
>>>>>
>>>>>   
>>>>>       
>>>>>> +    if (**p == '@')
>>>>>> +        start = memparse(*p + 1, p);
>>>>>> +
>>>>>> +    system_ram->start = start;
>>>>>> +    system_ram->end = system_ram->start + size - 1;
>>>>>> +    return 0;
>>>>>> +}
>>>>>> +early_param("mem", early_mem);
>>>>>> +
>>>>>>  static int __init parse_tag_core(struct tag *tag)
>>>>>>  {
>>>>>>      if (tag->hdr.size > 2) {
>>>>>> --
> 
> 
> ---
> ~Randy
> Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
> http://linuxplumbersconf.org/
> 

-- 
Marco Stornelli
Embedded Software Engineer
CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni
http://www.coritel.it

marco.stornelli@coritel.it
+39 06 72582838

  reply	other threads:[~2008-09-16  7:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-15 10:07 [PATCH 1/1] avr32: added mem kernel command line option support Marco Stornelli
2008-09-15 14:40 ` Randy Dunlap
2008-09-15 14:57   ` Marco Stornelli
2008-09-15 15:05     ` Randy Dunlap
2008-09-15 15:30       ` Marco Stornelli
2008-09-15 15:36         ` Randy Dunlap
2008-09-16  7:14           ` Marco Stornelli [this message]
2008-09-16  8:06             ` Haavard Skinnemoen

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=48CF5CBB.1050708@coritel.it \
    --to=marco.stornelli@coritel.it \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.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