Skip to content

Commit cec669f

Browse files
Mani-Sadhasivambp3tk0v
authored andcommitted
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: e27e3da ("drivers/edac: add edac_device class") Reported-by: Luca Weiss <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> # Thinkpad X13s Tested-by: Andrew Halaney <[email protected]> # sa8540p-ride Cc: <[email protected]> # 4.9 Link: https://lore.kernel.org/r/COZYL8MWN97H.MROQ391BGA09@otso
1 parent 5dc4c99 commit cec669f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/edac/edac_device.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
static DEFINE_MUTEX(device_ctls_mutex);
3535
static LIST_HEAD(edac_device_list);
3636

37+
/* Default workqueue processing interval on this instance, in msecs */
38+
#define DEFAULT_POLL_INTERVAL 1000
39+
3740
#ifdef CONFIG_EDAC_DEBUG
3841
static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
3942
{
@@ -336,7 +339,7 @@ static void edac_device_workq_function(struct work_struct *work_req)
336339
* whole one second to save timers firing all over the period
337340
* between integral seconds
338341
*/
339-
if (edac_dev->poll_msec == 1000)
342+
if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
340343
edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
341344
else
342345
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,
366369
* timers firing on sub-second basis, while they are happy
367370
* to fire together on the 1 second exactly
368371
*/
369-
if (edac_dev->poll_msec == 1000)
372+
if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
370373
edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
371374
else
372375
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,
400403
edac_dev->delay = msecs_to_jiffies(msec);
401404

402405
/* See comment in edac_device_workq_setup() above */
403-
if (edac_dev->poll_msec == 1000)
406+
if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
404407
edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
405408
else
406409
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)
442445
/* This instance is NOW RUNNING */
443446
edac_dev->op_state = OP_RUNNING_POLL;
444447

445-
/*
446-
* enable workq processing on this instance,
447-
* default = 1000 msec
448-
*/
449-
edac_device_workq_setup(edac_dev, 1000);
448+
edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL);
450449
} else {
451450
edac_dev->op_state = OP_RUNNING_INTERRUPT;
452451
}

0 commit comments

Comments
 (0)