Commit cb6ef42e authored by Borislav Petkov's avatar Borislav Petkov

EDAC: Correct workqueue setup path

We're using edac_mc_workq_setup() both on the init path, when
we load an edac driver and when we change the polling period
(edac_mc_reset_delay_period) through /sys/.../edac_mc_poll_msec.

On that second path we don't need to init the workqueue which has been
initialized already.

Thanks to Tejun for workqueue insights.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1391457913-881-1-git-send-email-prarit@redhat.com
Cc: <stable@vger.kernel.org>
parent 9da21b15
...@@ -559,7 +559,8 @@ static void edac_mc_workq_function(struct work_struct *work_req) ...@@ -559,7 +559,8 @@ static void edac_mc_workq_function(struct work_struct *work_req)
* *
* called with the mem_ctls_mutex held * called with the mem_ctls_mutex held
*/ */
static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec) static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec,
bool init)
{ {
edac_dbg(0, "\n"); edac_dbg(0, "\n");
...@@ -567,7 +568,9 @@ static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec) ...@@ -567,7 +568,9 @@ static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
if (mci->op_state != OP_RUNNING_POLL) if (mci->op_state != OP_RUNNING_POLL)
return; return;
if (init)
INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function); INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec)); mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec));
} }
...@@ -611,7 +614,7 @@ void edac_mc_reset_delay_period(unsigned long value) ...@@ -611,7 +614,7 @@ void edac_mc_reset_delay_period(unsigned long value)
list_for_each(item, &mc_devices) { list_for_each(item, &mc_devices) {
mci = list_entry(item, struct mem_ctl_info, link); mci = list_entry(item, struct mem_ctl_info, link);
edac_mc_workq_setup(mci, value); edac_mc_workq_setup(mci, value, false);
} }
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
...@@ -782,7 +785,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci) ...@@ -782,7 +785,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
/* This instance is NOW RUNNING */ /* This instance is NOW RUNNING */
mci->op_state = OP_RUNNING_POLL; mci->op_state = OP_RUNNING_POLL;
edac_mc_workq_setup(mci, edac_mc_get_poll_msec()); edac_mc_workq_setup(mci, edac_mc_get_poll_msec(), true);
} else { } else {
mci->op_state = OP_RUNNING_INTERRUPT; mci->op_state = OP_RUNNING_INTERRUPT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment