Commit cec669ff authored by Manivannan Sadhasivam's avatar Manivannan Sadhasivam Committed by Borislav Petkov (AMD)

EDAC/device: Respect any driver-supplied workqueue polling value

The EDAC drivers may optionally pass the poll_msec value. Use that value
if available, else fall back to 1000ms.

  [ bp: Touchups. ]

Fixes: e27e3dac ("drivers/edac: add edac_device class")
Reported-by: default avatarLuca Weiss <luca.weiss@fairphone.com>
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Tested-by: Steev Klimaszewski <steev@kali.org> # Thinkpad X13s
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8540p-ride
Cc: <stable@vger.kernel.org> # 4.9
Link: https://lore.kernel.org/r/COZYL8MWN97H.MROQ391BGA09@otso
parent 5dc4c995
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
static DEFINE_MUTEX(device_ctls_mutex); static DEFINE_MUTEX(device_ctls_mutex);
static LIST_HEAD(edac_device_list); static LIST_HEAD(edac_device_list);
/* Default workqueue processing interval on this instance, in msecs */
#define DEFAULT_POLL_INTERVAL 1000
#ifdef CONFIG_EDAC_DEBUG #ifdef CONFIG_EDAC_DEBUG
static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
{ {
...@@ -336,7 +339,7 @@ static void edac_device_workq_function(struct work_struct *work_req) ...@@ -336,7 +339,7 @@ static void edac_device_workq_function(struct work_struct *work_req)
* whole one second to save timers firing all over the period * whole one second to save timers firing all over the period
* between integral seconds * between integral seconds
*/ */
if (edac_dev->poll_msec == 1000) if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
else else
edac_queue_work(&edac_dev->work, edac_dev->delay); edac_queue_work(&edac_dev->work, edac_dev->delay);
...@@ -366,7 +369,7 @@ static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, ...@@ -366,7 +369,7 @@ static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
* timers firing on sub-second basis, while they are happy * timers firing on sub-second basis, while they are happy
* to fire together on the 1 second exactly * to fire together on the 1 second exactly
*/ */
if (edac_dev->poll_msec == 1000) if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
else else
edac_queue_work(&edac_dev->work, edac_dev->delay); edac_queue_work(&edac_dev->work, edac_dev->delay);
...@@ -400,7 +403,7 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, ...@@ -400,7 +403,7 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
edac_dev->delay = msecs_to_jiffies(msec); edac_dev->delay = msecs_to_jiffies(msec);
/* See comment in edac_device_workq_setup() above */ /* See comment in edac_device_workq_setup() above */
if (edac_dev->poll_msec == 1000) if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
else else
edac_mod_work(&edac_dev->work, edac_dev->delay); edac_mod_work(&edac_dev->work, edac_dev->delay);
...@@ -442,11 +445,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev) ...@@ -442,11 +445,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev)
/* This instance is NOW RUNNING */ /* This instance is NOW RUNNING */
edac_dev->op_state = OP_RUNNING_POLL; edac_dev->op_state = OP_RUNNING_POLL;
/* edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL);
* enable workq processing on this instance,
* default = 1000 msec
*/
edac_device_workq_setup(edac_dev, 1000);
} else { } else {
edac_dev->op_state = OP_RUNNING_INTERRUPT; edac_dev->op_state = OP_RUNNING_INTERRUPT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment