Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=940d67f6b95166475ff6e600ef7658e1cd441278
Commit:     940d67f6b95166475ff6e600ef7658e1cd441278
Parent:     de372ecd80a42c4fb485c7232475301a18d05184
Author:     Johannes Berg <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 19:23:49 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Wed May 9 16:34:56 2007 +1000

    [POWERPC] swsusp: Introduce register_nosave_region_late
    
    This patch introduces a new register_nosave_region_late function that
    can be called from initcalls when register_nosave_region can no longer
    be used because it uses bootmem.
    
    Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
    Acked-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 include/linux/suspend.h |   11 ++++++++++-
 kernel/power/snapshot.c |   12 +++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 9d2aa1a..1f2f7ba 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -34,13 +34,22 @@ static inline void pm_restore_console(void) {}
 
 #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
 /* kernel/power/snapshot.c */
-extern void __init register_nosave_region(unsigned long, unsigned long);
+extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
+static inline void register_nosave_region(unsigned long b, unsigned long e)
+{
+       __register_nosave_region(b, e, 0);
+}
+static inline void register_nosave_region_late(unsigned long b, unsigned long 
e)
+{
+       __register_nosave_region(b, e, 1);
+}
 extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
 #else
 static inline void register_nosave_region(unsigned long b, unsigned long e) {}
+static inline void register_nosave_region_late(unsigned long b, unsigned long 
e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index b703977..59fb89b 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -607,7 +607,8 @@ static LIST_HEAD(nosave_regions);
  */
 
 void __init
-register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
+__register_nosave_region(unsigned long start_pfn, unsigned long end_pfn,
+                        int use_kmalloc)
 {
        struct nosave_region *region;
 
@@ -623,8 +624,13 @@ register_nosave_region(unsigned long start_pfn, unsigned 
long end_pfn)
                        goto Report;
                }
        }
-       /* This allocation cannot fail */
-       region = alloc_bootmem_low(sizeof(struct nosave_region));
+       if (use_kmalloc) {
+               /* during init, this shouldn't fail */
+               region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
+               BUG_ON(!region);
+       } else
+               /* This allocation cannot fail */
+               region = alloc_bootmem_low(sizeof(struct nosave_region));
        region->start_pfn = start_pfn;
        region->end_pfn = end_pfn;
        list_add_tail(&region->list, &nosave_regions);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to