EDAC: Rework workqueue handling
[linux-2.6-microblaze.git] / drivers / edac / edac_device.c
index 455a64b..a979003 100644 (file)
@@ -390,11 +390,9 @@ static void edac_device_workq_function(struct work_struct *work_req)
         * between integral seconds
         */
        if (edac_dev->poll_msec == 1000)
-               queue_delayed_work(edac_workqueue, &edac_dev->work,
-                               round_jiffies_relative(edac_dev->delay));
+               edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
        else
-               queue_delayed_work(edac_workqueue, &edac_dev->work,
-                               edac_dev->delay);
+               edac_queue_work(&edac_dev->work, edac_dev->delay);
 }
 
 /*
@@ -422,11 +420,9 @@ static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
         * to fire together on the 1 second exactly
         */
        if (edac_dev->poll_msec == 1000)
-               queue_delayed_work(edac_workqueue, &edac_dev->work,
-                               round_jiffies_relative(edac_dev->delay));
+               edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
        else
-               queue_delayed_work(edac_workqueue, &edac_dev->work,
-                               edac_dev->delay);
+               edac_queue_work(&edac_dev->work, edac_dev->delay);
 }
 
 /*
@@ -440,8 +436,7 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
 
        edac_dev->op_state = OP_OFFLINE;
 
-       cancel_delayed_work_sync(&edac_dev->work);
-       flush_workqueue(edac_workqueue);
+       edac_stop_work(&edac_dev->work);
 }
 
 /*
@@ -454,16 +449,15 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
                                        unsigned long value)
 {
-       /* cancel the current workq request, without the mutex lock */
-       edac_device_workq_teardown(edac_dev);
+       unsigned long jiffs = msecs_to_jiffies(value);
 
-       /* acquire the mutex before doing the workq setup */
-       mutex_lock(&device_ctls_mutex);
+       if (value == 1000)
+               jiffs = round_jiffies_relative(value);
 
-       /* restart the workq request, with new delay value */
-       edac_device_workq_setup(edac_dev, value);
+       edac_dev->poll_msec = value;
+       edac_dev->delay     = jiffs;
 
-       mutex_unlock(&device_ctls_mutex);
+       edac_mod_work(&edac_dev->work, jiffs);
 }
 
 /*