ipmi: Factor out message flushing procedure
Factor out message flushing procedure which is used in run-to-completion mode. This patch doesn't change the logic. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
This commit is contained in:
parent
b0868dd5c1
commit
e45361d733
1 changed files with 18 additions and 21 deletions
|
@ -924,11 +924,25 @@ static void check_start_timer_thread(struct smi_info *smi_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void flush_messages(struct smi_info *smi_info)
|
||||||
|
{
|
||||||
|
enum si_sm_result result;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Currently, this function is called only in run-to-completion
|
||||||
|
* mode. This means we are single-threaded, no need for locks.
|
||||||
|
*/
|
||||||
|
result = smi_event_handler(smi_info, 0);
|
||||||
|
while (result != SI_SM_IDLE) {
|
||||||
|
udelay(SI_SHORT_TIMEOUT_USEC);
|
||||||
|
result = smi_event_handler(smi_info, SI_SHORT_TIMEOUT_USEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void sender(void *send_info,
|
static void sender(void *send_info,
|
||||||
struct ipmi_smi_msg *msg)
|
struct ipmi_smi_msg *msg)
|
||||||
{
|
{
|
||||||
struct smi_info *smi_info = send_info;
|
struct smi_info *smi_info = send_info;
|
||||||
enum si_sm_result result;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
debug_timestamp("Enqueue");
|
debug_timestamp("Enqueue");
|
||||||
|
@ -940,17 +954,7 @@ static void sender(void *send_info,
|
||||||
*/
|
*/
|
||||||
smi_info->waiting_msg = msg;
|
smi_info->waiting_msg = msg;
|
||||||
|
|
||||||
/*
|
flush_messages(smi_info);
|
||||||
* Run to completion means we are single-threaded, no
|
|
||||||
* need for locks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
result = smi_event_handler(smi_info, 0);
|
|
||||||
while (result != SI_SM_IDLE) {
|
|
||||||
udelay(SI_SHORT_TIMEOUT_USEC);
|
|
||||||
result = smi_event_handler(smi_info,
|
|
||||||
SI_SHORT_TIMEOUT_USEC);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,17 +975,10 @@ static void sender(void *send_info,
|
||||||
static void set_run_to_completion(void *send_info, bool i_run_to_completion)
|
static void set_run_to_completion(void *send_info, bool i_run_to_completion)
|
||||||
{
|
{
|
||||||
struct smi_info *smi_info = send_info;
|
struct smi_info *smi_info = send_info;
|
||||||
enum si_sm_result result;
|
|
||||||
|
|
||||||
smi_info->run_to_completion = i_run_to_completion;
|
smi_info->run_to_completion = i_run_to_completion;
|
||||||
if (i_run_to_completion) {
|
if (i_run_to_completion)
|
||||||
result = smi_event_handler(smi_info, 0);
|
flush_messages(smi_info);
|
||||||
while (result != SI_SM_IDLE) {
|
|
||||||
udelay(SI_SHORT_TIMEOUT_USEC);
|
|
||||||
result = smi_event_handler(smi_info,
|
|
||||||
SI_SHORT_TIMEOUT_USEC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue