aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_device.c
diff options
context:
space:
mode:
authorDave Jiang <djiang@mvista.com>2007-07-19 04:49:52 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:54 -0400
commit81d87cb13e367bb804bf44889ae0de7369705d6c (patch)
tree1c135cb57d92ae3baf2b3308f01fb548ab39f644 /drivers/edac/edac_device.c
parent535c6a53035d8911f6b90455550c5fde0da7b866 (diff)
drivers/edac: mod MC to use workq instead of kthread
Move the memory controller object to work queue based implementation from the kernel thread based. Signed-off-by: Dave Jiang <djiang@mvista.com> Signed-off-by: Douglas Thompson <dougthompson@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/edac_device.c')
-rw-r--r--drivers/edac/edac_device.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 52db1b14fff5..3f4c8a28154a 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -332,17 +332,17 @@ EXPORT_SYMBOL(edac_device_find);
332 332
333 333
334/* 334/*
335 * edac_workq_function 335 * edac_device_workq_function
336 * performs the operation scheduled by a workq request 336 * performs the operation scheduled by a workq request
337 */ 337 */
338#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 338#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
339static void edac_workq_function(struct work_struct *work_req) 339static void edac_device_workq_function(struct work_struct *work_req)
340{ 340{
341 struct delayed_work *d_work = (struct delayed_work*) work_req; 341 struct delayed_work *d_work = (struct delayed_work*) work_req;
342 struct edac_device_ctl_info *edac_dev = 342 struct edac_device_ctl_info *edac_dev =
343 to_edac_device_ctl_work(d_work); 343 to_edac_device_ctl_work(d_work);
344#else 344#else
345static void edac_workq_function(void *ptr) 345static void edac_device_workq_function(void *ptr)
346{ 346{
347 struct edac_device_ctl_info *edac_dev = 347 struct edac_device_ctl_info *edac_dev =
348 (struct edac_device_ctl_info *) ptr; 348 (struct edac_device_ctl_info *) ptr;
@@ -364,30 +364,31 @@ static void edac_workq_function(void *ptr)
364} 364}
365 365
366/* 366/*
367 * edac_workq_setup 367 * edac_device_workq_setup
368 * initialize a workq item for this edac_device instance 368 * initialize a workq item for this edac_device instance
369 * passing in the new delay period in msec 369 * passing in the new delay period in msec
370 */ 370 */
371void edac_workq_setup(struct edac_device_ctl_info *edac_dev, unsigned msec) 371void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
372 unsigned msec)
372{ 373{
373 debugf0("%s()\n", __func__); 374 debugf0("%s()\n", __func__);
374 375
375 edac_dev->poll_msec = msec; 376 edac_dev->poll_msec = msec;
376 edac_device_calc_delay(edac_dev); /* Calc delay jiffies */ 377 edac_calc_delay(edac_dev); /* Calc delay jiffies */
377 378
378#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 379#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
379 INIT_DELAYED_WORK(&edac_dev->work,edac_workq_function); 380 INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function);
380#else 381#else
381 INIT_WORK(&edac_dev->work,edac_workq_function,edac_dev); 382 INIT_WORK(&edac_dev->work, edac_device_workq_function, edac_dev);
382#endif 383#endif
383 queue_delayed_work(edac_workqueue,&edac_dev->work, edac_dev->delay); 384 queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay);
384} 385}
385 386
386/* 387/*
387 * edac_workq_teardown 388 * edac_device_workq_teardown
388 * stop the workq processing on this edac_dev 389 * stop the workq processing on this edac_dev
389 */ 390 */
390void edac_workq_teardown(struct edac_device_ctl_info *edac_dev) 391void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
391{ 392{
392 int status; 393 int status;
393 394
@@ -409,10 +410,10 @@ void edac_device_reset_delay_period(
409 lock_device_list(); 410 lock_device_list();
410 411
411 /* cancel the current workq request */ 412 /* cancel the current workq request */
412 edac_workq_teardown(edac_dev); 413 edac_device_workq_teardown(edac_dev);
413 414
414 /* restart the workq request, with new delay value */ 415 /* restart the workq request, with new delay value */
415 edac_workq_setup(edac_dev, value); 416 edac_device_workq_setup(edac_dev, value);
416 417
417 unlock_device_list(); 418 unlock_device_list();
418} 419}
@@ -479,8 +480,11 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
479 /* This instance is NOW RUNNING */ 480 /* This instance is NOW RUNNING */
480 edac_dev->op_state = OP_RUNNING_POLL; 481 edac_dev->op_state = OP_RUNNING_POLL;
481 482
482 /* enable workq processing on this instance, default = 1000 msec */ 483 /*
483 edac_workq_setup(edac_dev, 1000); 484 * enable workq processing on this instance,
485 * default = 1000 msec
486 */
487 edac_device_workq_setup(edac_dev, 1000);
484 } else { 488 } else {
485 edac_dev->op_state = OP_RUNNING_INTERRUPT; 489 edac_dev->op_state = OP_RUNNING_INTERRUPT;
486 } 490 }
@@ -538,7 +542,7 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev)
538 edac_dev->op_state = OP_OFFLINE; 542 edac_dev->op_state = OP_OFFLINE;
539 543
540 /* clear workq processing on this instance */ 544 /* clear workq processing on this instance */
541 edac_workq_teardown(edac_dev); 545 edac_device_workq_teardown(edac_dev);
542 546
543 /* Tear down the sysfs entries for this instance */ 547 /* Tear down the sysfs entries for this instance */
544 edac_device_remove_sysfs(edac_dev); 548 edac_device_remove_sysfs(edac_dev);