Skip to content

Commit cb6ef42

Browse files
committed
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: Borislav Petkov <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Cc: <[email protected]>
1 parent 9da21b1 commit cb6ef42

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/edac/edac_mc.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,18 @@ static void edac_mc_workq_function(struct work_struct *work_req)
559559
*
560560
* called with the mem_ctls_mutex held
561561
*/
562-
static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
562+
static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec,
563+
bool init)
563564
{
564565
edac_dbg(0, "\n");
565566

566567
/* if this instance is not in the POLL state, then simply return */
567568
if (mci->op_state != OP_RUNNING_POLL)
568569
return;
569570

570-
INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
571+
if (init)
572+
INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
573+
571574
mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec));
572575
}
573576

@@ -611,7 +614,7 @@ void edac_mc_reset_delay_period(unsigned long value)
611614
list_for_each(item, &mc_devices) {
612615
mci = list_entry(item, struct mem_ctl_info, link);
613616

614-
edac_mc_workq_setup(mci, value);
617+
edac_mc_workq_setup(mci, value, false);
615618
}
616619

617620
mutex_unlock(&mem_ctls_mutex);
@@ -782,7 +785,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
782785
/* This instance is NOW RUNNING */
783786
mci->op_state = OP_RUNNING_POLL;
784787

785-
edac_mc_workq_setup(mci, edac_mc_get_poll_msec());
788+
edac_mc_workq_setup(mci, edac_mc_get_poll_msec(), true);
786789
} else {
787790
mci->op_state = OP_RUNNING_INTERRUPT;
788791
}

0 commit comments

Comments
 (0)