]> git.karo-electronics.de Git - linux-beck.git/commitdiff
EDAC: Cleanup/sync workqueue functions
authorBorislav Petkov <bp@suse.de>
Tue, 2 Feb 2016 10:36:11 +0000 (11:36 +0100)
committerBorislav Petkov <bp@suse.de>
Tue, 2 Feb 2016 10:38:50 +0000 (11:38 +0100)
They're both running only when ->edac_check is initialized so remove
that check from the workqueue function itself. Synchronize/generalize
the ->op_state check between the two.

Kill useless comments, while at it.

Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/edac_mc.c
drivers/edac/edac_pci.c

index 050493edb50580350b7aa81dab1675dd2a692332..1472f48c8ac6109677f28da6d1067c11e3e16fa4 100644 (file)
@@ -535,19 +535,17 @@ static void edac_mc_workq_function(struct work_struct *work_req)
 
        mutex_lock(&mem_ctls_mutex);
 
-       /* if this control struct has movd to offline state, we are done */
-       if (mci->op_state == OP_OFFLINE) {
+       if (mci->op_state != OP_RUNNING_POLL) {
                mutex_unlock(&mem_ctls_mutex);
                return;
        }
 
-       /* Only poll controllers that are running polled and have a check */
-       if (edac_mc_assert_error_check_and_clear() && (mci->edac_check != NULL))
+       if (edac_mc_assert_error_check_and_clear())
                mci->edac_check(mci);
 
        mutex_unlock(&mem_ctls_mutex);
 
-       /* Reschedule */
+       /* Queue ourselves again. */
        edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
 }
 
index 79945e0df0dca8d9475076ee3f7bb802ee9eb3e3..8f2f2899a7a2e06070689a535a1eb54171fd0ef7 100644 (file)
@@ -195,23 +195,23 @@ static void edac_pci_workq_function(struct work_struct *work_req)
 
        mutex_lock(&edac_pci_ctls_mutex);
 
-       if (pci->op_state == OP_RUNNING_POLL) {
-               /* we might be in POLL mode, but there may NOT be a poll func
-                */
-               if ((pci->edac_check != NULL) && edac_pci_get_check_errors())
-                       pci->edac_check(pci);
-
-               /* if we are on a one second period, then use round */
-               msec = edac_pci_get_poll_msec();
-               if (msec == 1000)
-                       delay = round_jiffies_relative(msecs_to_jiffies(msec));
-               else
-                       delay = msecs_to_jiffies(msec);
-
-               /* Reschedule only if we are in POLL mode */
-               edac_queue_work(&pci->work, delay);
+       if (pci->op_state != OP_RUNNING_POLL) {
+               mutex_unlock(&edac_pci_ctls_mutex);
+               return;
        }
 
+       if (edac_pci_get_check_errors())
+               pci->edac_check(pci);
+
+       /* if we are on a one second period, then use round */
+       msec = edac_pci_get_poll_msec();
+       if (msec == 1000)
+               delay = round_jiffies_relative(msecs_to_jiffies(msec));
+       else
+               delay = msecs_to_jiffies(msec);
+
+       edac_queue_work(&pci->work, delay);
+
        mutex_unlock(&edac_pci_ctls_mutex);
 }