aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2014-02-12 12:15:00 -0500
committerBorislav Petkov <bp@suse.de>2014-02-14 04:40:47 -0500
commitcb6ef42e516cb8948f15e4b70dc03af8020050a2 (patch)
treebc4a1154843c73bf699ffba106b7a762ba4fe4da /drivers/edac/edac_mc.c
parent9da21b1509d8aa7ab4846722817d16c72d656c91 (diff)
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 <bp@suse.de> Link: http://lkml.kernel.org/r/1391457913-881-1-git-send-email-prarit@redhat.com Cc: <stable@vger.kernel.org>
Diffstat (limited to 'drivers/edac/edac_mc.c')
-rw-r--r--drivers/edac/edac_mc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index aef5ec24908e..33edd6766344 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -559,7 +559,8 @@ static void edac_mc_workq_function(struct work_struct *work_req)
559 * 559 *
560 * called with the mem_ctls_mutex held 560 * called with the mem_ctls_mutex held
561 */ 561 */
562static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec) 562static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec,
563 bool init)
563{ 564{
564 edac_dbg(0, "\n"); 565 edac_dbg(0, "\n");
565 566
@@ -567,7 +568,9 @@ static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
567 if (mci->op_state != OP_RUNNING_POLL) 568 if (mci->op_state != OP_RUNNING_POLL)
568 return; 569 return;
569 570
570 INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function); 571 if (init)
572 INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
573
571 mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec)); 574 mod_delayed_work(edac_workqueue, &mci->work, msecs_to_jiffies(msec));
572} 575}
573 576
@@ -611,7 +614,7 @@ void edac_mc_reset_delay_period(unsigned long value)
611 list_for_each(item, &mc_devices) { 614 list_for_each(item, &mc_devices) {
612 mci = list_entry(item, struct mem_ctl_info, link); 615 mci = list_entry(item, struct mem_ctl_info, link);
613 616
614 edac_mc_workq_setup(mci, value); 617 edac_mc_workq_setup(mci, value, false);
615 } 618 }
616 619
617 mutex_unlock(&mem_ctls_mutex); 620 mutex_unlock(&mem_ctls_mutex);
@@ -782,7 +785,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
782 /* This instance is NOW RUNNING */ 785 /* This instance is NOW RUNNING */
783 mci->op_state = OP_RUNNING_POLL; 786 mci->op_state = OP_RUNNING_POLL;
784 787
785 edac_mc_workq_setup(mci, edac_mc_get_poll_msec()); 788 edac_mc_workq_setup(mci, edac_mc_get_poll_msec(), true);
786 } else { 789 } else {
787 mci->op_state = OP_RUNNING_INTERRUPT; 790 mci->op_state = OP_RUNNING_INTERRUPT;
788 } 791 }