]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/check.c
Merge branch 'origin' into devel
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / check.c
index 5056703e1b057c3e671731f52a8e724e805c9999..2ac0ab71412a59f9c9e0b025d88f0acf9e7e39ff 100644 (file)
@@ -1,6 +1,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
-
+#include <linux/kthread.h>
+#include <linux/workqueue.h>
 #include <asm/e820.h>
 #include <asm/proto.h>
 
@@ -10,7 +11,6 @@
  * remaining free memory in that area and fill it with a distinct
  * pattern.
  */
-#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
 #define MAX_SCAN_AREAS 8
 
 static int __read_mostly memory_corruption_check = -1;
@@ -22,7 +22,7 @@ static struct e820entry scan_areas[MAX_SCAN_AREAS];
 static int num_scan_areas;
 
 
-static int set_corruption_check(char *arg)
+static __init int set_corruption_check(char *arg)
 {
        char *end;
 
@@ -32,7 +32,7 @@ static int set_corruption_check(char *arg)
 }
 early_param("memory_corruption_check", set_corruption_check);
 
-static int set_corruption_check_period(char *arg)
+static __init int set_corruption_check_period(char *arg)
 {
        char *end;
 
@@ -42,7 +42,7 @@ static int set_corruption_check_period(char *arg)
 }
 early_param("memory_corruption_check_period", set_corruption_check_period);
 
-static int set_corruption_check_size(char *arg)
+static __init int set_corruption_check_size(char *arg)
 {
        char *end;
        unsigned size;
@@ -108,7 +108,6 @@ void __init setup_bios_corruption_check(void)
        update_e820();
 }
 
-static struct timer_list periodic_check_timer;
 
 void check_for_bios_corruption(void)
 {
@@ -132,27 +131,31 @@ void check_for_bios_corruption(void)
                }
        }
 
-       WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
+       WARN_ONCE(corruption, KERN_ERR "Memory corruption detected in low memory\n");
 }
 
-static void periodic_check_for_corruption(unsigned long data)
+static void check_corruption(struct work_struct *dummy);
+static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
+
+static void check_corruption(struct work_struct *dummy)
 {
        check_for_bios_corruption();
-       mod_timer(&periodic_check_timer,
-               round_jiffies(jiffies + corruption_check_period*HZ));
+       schedule_delayed_work(&bios_check_work,
+               round_jiffies_relative(corruption_check_period*HZ)); 
 }
 
-void start_periodic_check_for_corruption(void)
+static int start_periodic_check_for_corruption(void)
 {
        if (!memory_corruption_check || corruption_check_period == 0)
-               return;
+               return 0;
 
        printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
               corruption_check_period);
 
-       init_timer(&periodic_check_timer);
-       periodic_check_timer.function = &periodic_check_for_corruption;
-       periodic_check_for_corruption(0);
+       /* First time we run the checks right away */
+       schedule_delayed_work(&bios_check_work, 0);
+       return 0;
 }
-#endif
+
+module_init(start_periodic_check_for_corruption);