Re: [PATCH 1/1] avr32: added mem kernel command line option support

Previous thread: [PATCH] cifs: don't use GFP_KERNEL with GFP_NOFS by Pekka J Enberg on Monday, September 15, 2008 - 3:22 am. (1 message)

Next thread: [fbdev] Lockdep error by Dmitry Baryshkov on Monday, September 15, 2008 - 5:21 am. (3 messages)
From: Marco Stornelli
Date: Monday, September 15, 2008 - 3:07 am

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]"
+ */
+static int __init early_mem(char **p)
+{
+    unsigned long 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) {
--

From: Randy Dunlap
Date: Monday, September 15, 2008 - 7:40 am

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

From: Marco Stornelli
Date: Monday, September 15, 2008 - 7:57 am

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.


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

marco.stornelli@coritel.it
+39 06 72582838

--

From: Randy Dunlap
Date: Monday, September 15, 2008 - 8:05 am

Yes, I think that would be better.



---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

From: Marco Stornelli
Date: Monday, September 15, 2008 - 8:30 am

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);
+
+ 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) {


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

marco.stornelli@coritel.it
+39 06 72582838

--

From: Randy Dunlap
Date: Monday, September 15, 2008 - 8:36 am

Lots of whitespace damage here.  Your first patch looked OK


---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

From: Marco Stornelli
Date: Tuesday, September 16, 2008 - 12:14 am

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) {



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

marco.stornelli@coritel.it
+39 06 72582838
--

From: Haavard Skinnemoen
Date: Tuesday, September 16, 2008 - 1:06 am

Please see Documentation/email-clients.txt. Thunderbird apparently has


I've fixed it up, but I recommend that you send a few patches to
yourself and try to fix your setup. It's not much of a problem for a
small patch like this, but longer, more complicated ones may take quite
some time to unmangle.

The rest of the patch looks good. Although avr32 only supports 32-bit
physical addresses, I believe resource_size_t is more correct than
unsigned long.

Applied, thanks.

Haavard
--

Previous thread: [PATCH] cifs: don't use GFP_KERNEL with GFP_NOFS by Pekka J Enberg on Monday, September 15, 2008 - 3:22 am. (1 message)

Next thread: [fbdev] Lockdep error by Dmitry Baryshkov on Monday, September 15, 2008 - 5:21 am. (3 messages)