static int ipmi_set_timeout(int do_heartbeat) { int send_heartbeat_now; int rv; /* We can only send one of these at a time. */ down(&set_timeout_lock); atomic_set(&set_timeout_tofree, 2); rv = i_ipmi_set_timeout(&set_timeout_smi_msg, &set_timeout_recv_msg, &send_heartbeat_now); if (rv) { up(&set_timeout_lock); } else { if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) || ((send_heartbeat_now) && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) { rv = ipmi_heartbeat(); } } return rv; }
static int ipmi_set_timeout(int do_heartbeat) { int send_heartbeat_now; int rv; /* We can only send one of these at a time. */ mutex_lock(&set_timeout_lock); atomic_set(&set_timeout_tofree, 2); rv = i_ipmi_set_timeout(&set_timeout_smi_msg, &set_timeout_recv_msg, &send_heartbeat_now); if (rv) { mutex_unlock(&set_timeout_lock); goto out; } wait_for_completion(&set_timeout_wait); mutex_unlock(&set_timeout_lock); if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) || ((send_heartbeat_now) && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) rv = ipmi_heartbeat(); out: return rv; }
/* * Special call, doesn't claim any locks. This is only to be called * at panic or halt time, in run-to-completion mode, when the caller * is the only CPU and the only thing that will be going is these IPMI * calls. */ static void panic_halt_ipmi_set_timeout(void) { int send_heartbeat_now; int rv; /* Wait for the messages to be free. */ while (atomic_read(&panic_done_count) != 0) ipmi_poll_interface(watchdog_user); rv = i_ipmi_set_timeout(&panic_halt_smi_msg, &panic_halt_recv_msg, &send_heartbeat_now); if (!rv) { atomic_add(2, &panic_done_count); if (send_heartbeat_now) panic_halt_ipmi_heartbeat(); } else #ifdef CONFIG_DEBUG_PRINTK printk(KERN_WARNING PFX "Unable to extend the watchdog timeout."); #else ; #endif while (atomic_read(&panic_done_count) != 0) ipmi_poll_interface(watchdog_user); }
/* Special call, doesn't claim any locks. This is only to be called at panic or halt time, in run-to-completion mode, when the caller is the only CPU and the only thing that will be going is these IPMI calls. */ static void panic_halt_ipmi_set_timeout(void) { int send_heartbeat_now; int rv; rv = i_ipmi_set_timeout(&panic_halt_smi_msg, &panic_halt_recv_msg, &send_heartbeat_now); if (!rv) { if (send_heartbeat_now) panic_halt_ipmi_heartbeat(); } }
static void panic_halt_ipmi_set_timeout(void) { int send_heartbeat_now; int rv; while (atomic_read(&panic_done_count) != 0) ipmi_poll_interface(watchdog_user); rv = i_ipmi_set_timeout(&panic_halt_smi_msg, &panic_halt_recv_msg, &send_heartbeat_now); if (!rv) { atomic_add(2, &panic_done_count); if (send_heartbeat_now) panic_halt_ipmi_heartbeat(); } else printk(KERN_WARNING PFX "Unable to extend the watchdog timeout."); while (atomic_read(&panic_done_count) != 0) ipmi_poll_interface(watchdog_user); }