Merge tag 'xfs-for-linus-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / drivers / edac / edac_mc.c
index 8adfc167c2e38e7de64c0a08224a803ad737ae7a..1472f48c8ac6109677f28da6d1067c11e3e16fa4 100644 (file)
@@ -535,59 +535,20 @@ 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()));
 }
 
-/*
- * edac_mc_workq_setup
- *     initialize a workq item for this mci
- *     passing in the new delay period in msec
- *
- *     locking model:
- *
- *             called with the mem_ctls_mutex held
- */
-static void edac_mc_workq_setup(struct mem_ctl_info *mci, unsigned msec)
-{
-       edac_dbg(0, "\n");
-
-       /* if this instance is not in the POLL state, then simply return */
-       if (mci->op_state != OP_RUNNING_POLL)
-               return;
-
-       INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
-
-       edac_queue_work(&mci->work, msecs_to_jiffies(msec));
-}
-
-/*
- * edac_mc_workq_teardown
- *     stop the workq processing on this mci
- *
- *     locking model:
- *
- *             called WITHOUT lock held
- */
-static void edac_mc_workq_teardown(struct mem_ctl_info *mci)
-{
-       mci->op_state = OP_OFFLINE;
-
-       edac_stop_work(&mci->work);
-}
-
 /*
  * edac_mc_reset_delay_period(unsigned long value)
  *
@@ -771,12 +732,12 @@ int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci,
                goto fail1;
        }
 
-       /* If there IS a check routine, then we are running POLLED */
-       if (mci->edac_check != NULL) {
-               /* This instance is NOW RUNNING */
+       if (mci->edac_check) {
                mci->op_state = OP_RUNNING_POLL;
 
-               edac_mc_workq_setup(mci, edac_mc_get_poll_msec());
+               INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
+               edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
+
        } else {
                mci->op_state = OP_RUNNING_INTERRUPT;
        }
@@ -823,15 +784,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
                return NULL;
        }
 
+       /* mark MCI offline: */
+       mci->op_state = OP_OFFLINE;
+
        if (!del_mc_from_global_list(mci))
                edac_mc_owner = NULL;
-       mutex_unlock(&mem_ctls_mutex);
 
-       /* flush workq processes */
-       edac_mc_workq_teardown(mci);
+       mutex_unlock(&mem_ctls_mutex);
 
-       /* marking MCI offline */
-       mci->op_state = OP_OFFLINE;
+       if (mci->edac_check)
+               edac_stop_work(&mci->work);
 
        /* remove from sysfs */
        edac_remove_sysfs_mci_device(mci);
This page took 0.025548 seconds and 5 git commands to generate.