| .. | .. |
|---|
| 34 | 34 | static DEFINE_MUTEX(device_ctls_mutex); |
|---|
| 35 | 35 | static LIST_HEAD(edac_device_list); |
|---|
| 36 | 36 | |
|---|
| 37 | +/* Default workqueue processing interval on this instance, in msecs */ |
|---|
| 38 | +#define DEFAULT_POLL_INTERVAL 1000 |
|---|
| 39 | + |
|---|
| 37 | 40 | #ifdef CONFIG_EDAC_DEBUG |
|---|
| 38 | 41 | static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) |
|---|
| 39 | 42 | { |
|---|
| .. | .. |
|---|
| 366 | 369 | * whole one second to save timers firing all over the period |
|---|
| 367 | 370 | * between integral seconds |
|---|
| 368 | 371 | */ |
|---|
| 369 | | - if (edac_dev->poll_msec == 1000) |
|---|
| 372 | + if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
|---|
| 370 | 373 | edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
|---|
| 371 | 374 | else |
|---|
| 372 | 375 | edac_queue_work(&edac_dev->work, edac_dev->delay); |
|---|
| .. | .. |
|---|
| 396 | 399 | * timers firing on sub-second basis, while they are happy |
|---|
| 397 | 400 | * to fire together on the 1 second exactly |
|---|
| 398 | 401 | */ |
|---|
| 399 | | - if (edac_dev->poll_msec == 1000) |
|---|
| 402 | + if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
|---|
| 400 | 403 | edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
|---|
| 401 | 404 | else |
|---|
| 402 | 405 | edac_queue_work(&edac_dev->work, edac_dev->delay); |
|---|
| .. | .. |
|---|
| 424 | 427 | * Then restart the workq on the new delay |
|---|
| 425 | 428 | */ |
|---|
| 426 | 429 | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, |
|---|
| 427 | | - unsigned long value) |
|---|
| 430 | + unsigned long msec) |
|---|
| 428 | 431 | { |
|---|
| 429 | | - unsigned long jiffs = msecs_to_jiffies(value); |
|---|
| 432 | + edac_dev->poll_msec = msec; |
|---|
| 433 | + edac_dev->delay = msecs_to_jiffies(msec); |
|---|
| 430 | 434 | |
|---|
| 431 | | - if (value == 1000) |
|---|
| 432 | | - jiffs = round_jiffies_relative(value); |
|---|
| 433 | | - |
|---|
| 434 | | - edac_dev->poll_msec = value; |
|---|
| 435 | | - edac_dev->delay = jiffs; |
|---|
| 436 | | - |
|---|
| 437 | | - edac_mod_work(&edac_dev->work, jiffs); |
|---|
| 435 | + /* See comment in edac_device_workq_setup() above */ |
|---|
| 436 | + if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) |
|---|
| 437 | + edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); |
|---|
| 438 | + else |
|---|
| 439 | + edac_mod_work(&edac_dev->work, edac_dev->delay); |
|---|
| 438 | 440 | } |
|---|
| 439 | 441 | |
|---|
| 440 | 442 | int edac_device_alloc_index(void) |
|---|
| .. | .. |
|---|
| 473 | 475 | /* This instance is NOW RUNNING */ |
|---|
| 474 | 476 | edac_dev->op_state = OP_RUNNING_POLL; |
|---|
| 475 | 477 | |
|---|
| 476 | | - /* |
|---|
| 477 | | - * enable workq processing on this instance, |
|---|
| 478 | | - * default = 1000 msec |
|---|
| 479 | | - */ |
|---|
| 480 | | - edac_device_workq_setup(edac_dev, 1000); |
|---|
| 478 | + edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL); |
|---|
| 481 | 479 | } else { |
|---|
| 482 | 480 | edac_dev->op_state = OP_RUNNING_INTERRUPT; |
|---|
| 483 | 481 | } |
|---|