]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/sn/kernel/xpc_main.c
[IA64] Replace explicit jiffies tests with time_* macros.
[linux-2.6-omap-h63xx.git] / arch / ia64 / sn / kernel / xpc_main.c
index 7a387d2373637a7ba9801f0691820674680ae24f..9e0b164da9c27a3e040f113354a57b9f4de291fa 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2004-2006 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
@@ -55,9 +55,9 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/completion.h>
+#include <linux/kdebug.h>
 #include <asm/sn/intr.h>
 #include <asm/sn/sn_sal.h>
-#include <asm/kdebug.h>
 #include <asm/uaccess.h>
 #include <asm/sn/xpc.h>
 
@@ -101,67 +101,57 @@ static int xpc_disengage_request_max_timelimit = 120;
 
 static ctl_table xpc_sys_xpc_hb_dir[] = {
        {
-               1,
-               "hb_interval",
-               &xpc_hb_interval,
-               sizeof(int),
-               0644,
-               NULL,
-               &proc_dointvec_minmax,
-               &sysctl_intvec,
-               NULL,
-               &xpc_hb_min_interval,
-               &xpc_hb_max_interval
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "hb_interval",
+               .data           = &xpc_hb_interval,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &xpc_hb_min_interval,
+               .extra2         = &xpc_hb_max_interval
        },
        {
-               2,
-               "hb_check_interval",
-               &xpc_hb_check_interval,
-               sizeof(int),
-               0644,
-               NULL,
-               &proc_dointvec_minmax,
-               &sysctl_intvec,
-               NULL,
-               &xpc_hb_check_min_interval,
-               &xpc_hb_check_max_interval
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "hb_check_interval",
+               .data           = &xpc_hb_check_interval,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &xpc_hb_check_min_interval,
+               .extra2         = &xpc_hb_check_max_interval
        },
-       {0}
+       {}
 };
 static ctl_table xpc_sys_xpc_dir[] = {
        {
-               1,
-               "hb",
-               NULL,
-               0,
-               0555,
-               xpc_sys_xpc_hb_dir
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "hb",
+               .mode           = 0555,
+               .child          = xpc_sys_xpc_hb_dir
        },
        {
-               2,
-               "disengage_request_timelimit",
-               &xpc_disengage_request_timelimit,
-               sizeof(int),
-               0644,
-               NULL,
-               &proc_dointvec_minmax,
-               &sysctl_intvec,
-               NULL,
-               &xpc_disengage_request_min_timelimit,
-               &xpc_disengage_request_max_timelimit
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "disengage_request_timelimit",
+               .data           = &xpc_disengage_request_timelimit,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &xpc_disengage_request_min_timelimit,
+               .extra2         = &xpc_disengage_request_max_timelimit
        },
-       {0}
+       {}
 };
 static ctl_table xpc_sys_dir[] = {
        {
-               1,
-               "xpc",
-               NULL,
-               0,
-               0555,
-               xpc_sys_xpc_dir
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "xpc",
+               .mode           = 0555,
+               .child          = xpc_sys_xpc_dir
        },
-       {0}
+       {}
 };
 static struct ctl_table_header *xpc_sysctl;
 
@@ -209,7 +199,7 @@ xpc_timeout_partition_disengage_request(unsigned long data)
        struct xpc_partition *part = (struct xpc_partition *) data;
 
 
-       DBUG_ON(jiffies < part->disengage_request_timeout);
+       DBUG_ON(time_before(jiffies, part->disengage_request_timeout));
 
        (void) xpc_partition_disengaged(part);
 
@@ -240,7 +230,7 @@ xpc_hb_beater(unsigned long dummy)
 {
        xpc_vars->heartbeat++;
 
-       if (jiffies >= xpc_hb_check_timeout) {
+       if (time_after_eq(jiffies, xpc_hb_check_timeout)) {
                wake_up_interruptible(&xpc_act_IRQ_wq);
        }
 
@@ -267,7 +257,9 @@ xpc_hb_checker(void *ignore)
 
        set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU));
 
+       /* set our heartbeating to other partitions into motion */
        xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ);
+       xpc_hb_beater(0);
 
        while (!(volatile int) xpc_exiting) {
 
@@ -278,7 +270,7 @@ xpc_hb_checker(void *ignore)
 
 
                /* checking of remote heartbeats is skewed by IRQ handling */
-               if (jiffies >= xpc_hb_check_timeout) {
+               if (time_after_eq(jiffies, xpc_hb_check_timeout)) {
                        dev_dbg(xpc_part, "checking remote heartbeats\n");
                        xpc_check_remote_hb();
 
@@ -313,7 +305,7 @@ xpc_hb_checker(void *ignore)
                /* wait for IRQ or timeout */
                (void) wait_event_interruptible(xpc_act_IRQ_wq,
                            (last_IRQ_count < atomic_read(&xpc_act_IRQ_rcvd) ||
-                                       jiffies >= xpc_hb_check_timeout ||
+                                       time_after_eq(jiffies, xpc_hb_check_timeout) ||
                                                (volatile int) xpc_exiting));
        }
 
@@ -1251,7 +1243,7 @@ xpc_init(void)
        snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part");
        snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan");
 
-       xpc_sysctl = register_sysctl_table(xpc_sys_dir, 1);
+       xpc_sysctl = register_sysctl_table(xpc_sys_dir);
 
        /*
         * The first few fields of each entry of xpc_partitions[] need to
@@ -1342,22 +1334,14 @@ xpc_init(void)
                dev_warn(xpc_part, "can't register reboot notifier\n");
        }
 
-       /* add ourselves to the die_notifier list (i.e., ia64die_chain) */
+       /* add ourselves to the die_notifier list */
        ret = register_die_notifier(&xpc_die_notifier);
        if (ret != 0) {
                dev_warn(xpc_part, "can't register die notifier\n");
        }
 
-
-       /*
-        * Set the beating to other partitions into motion.  This is
-        * the last requirement for other partitions' discovery to
-        * initiate communications with us.
-        */
        init_timer(&xpc_hb_timer);
        xpc_hb_timer.function = xpc_hb_beater;
-       xpc_hb_beater(0);
-
 
        /*
         * The real work-horse behind xpc.  This processes incoming