]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] memory hotadd fixes: change find_next_system_ram's return value manner
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Sat, 5 Aug 2006 19:14:59 +0000 (12:14 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 6 Aug 2006 15:57:48 +0000 (08:57 -0700)
find_next_system_ram() returns valid memory range which meets requested area,
only used by memory-hot-add.

This function always rewrite requested resource even if returned area is not
fully fit in requested one.  And sometimes the returnd resource is larger than
requested area.  This annoyes the caller.  This patch changes the returned
value to fit in requested area.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Keith Mannthey <kmannth@gmail.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/resource.c

index 0dd3a857579e4fe1b9aae9463aac4717e149eaa9..63e879379dbdafc5679421ac9c6095b4603de144 100644 (file)
@@ -261,8 +261,10 @@ int find_next_system_ram(struct resource *res)
        if (!p)
                return -1;
        /* copy data */
-       res->start = p->start;
-       res->end = p->end;
+       if (res->start < p->start)
+               res->start = p->start;
+       if (res->end > p->end)
+               res->end = p->end;
        return 0;
 }
 #endif