aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_device.c
diff options
context:
space:
mode:
authorDoug Thompson <dougthompson@xmission.com>2007-07-19 04:50:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:56 -0400
commit0ca84761faeb9d49301d45b39859411c7a124690 (patch)
tree742416b9c5db96227be2de0004b6b81058779029 /drivers/edac/edac_device.c
parent7f065e723b02afb0d36a2aae8e6d206ba2667fc6 (diff)
drivers/edac: fix edac_device semaphore to mutex
A previous patch changed the edac_mc src file from semaphore usage to mutex This patch changes the edac_device src file as well, from semaphore use to mutex operation. Use a mutex primitive for mutex operations, as it does not require a semaphore Cc: Alan Cox alan@lxorguk.ukuu.org.uk Signed-off-by: Doug Thompson <dougthompson@xmission.com> Cc: Greg KH <greg@kroah.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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 1d2eb20304f6..b53e8d51d9a5 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -33,7 +33,7 @@
33#include "edac_module.h" 33#include "edac_module.h"
34 34
35/* lock to memory controller's control array 'edac_device_list' */ 35/* lock to memory controller's control array 'edac_device_list' */
36static DECLARE_MUTEX(device_ctls_mutex); 36static DEFINE_MUTEX(device_ctls_mutex);
37static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list); 37static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list);
38 38
39#ifdef CONFIG_EDAC_DEBUG 39#ifdef CONFIG_EDAC_DEBUG
@@ -340,7 +340,7 @@ static void edac_device_workq_function(struct work_struct *work_req)
340 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); 340 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
341 341
342 //debugf0("%s() here and running\n", __func__); 342 //debugf0("%s() here and running\n", __func__);
343 down(&device_ctls_mutex); 343 mutex_lock(&device_ctls_mutex);
344 344
345 /* Only poll controllers that are running polled and have a check */ 345 /* Only poll controllers that are running polled and have a check */
346 if ((edac_dev->op_state == OP_RUNNING_POLL) && 346 if ((edac_dev->op_state == OP_RUNNING_POLL) &&
@@ -348,7 +348,7 @@ static void edac_device_workq_function(struct work_struct *work_req)
348 edac_dev->edac_check(edac_dev); 348 edac_dev->edac_check(edac_dev);
349 } 349 }
350 350
351 up(&device_ctls_mutex); 351 mutex_unlock(&device_ctls_mutex);
352 352
353 /* Reschedule */ 353 /* Reschedule */
354 queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); 354 queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay);
@@ -393,7 +393,7 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
393void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, 393void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
394 unsigned long value) 394 unsigned long value)
395{ 395{
396 down(&device_ctls_mutex); 396 mutex_lock(&device_ctls_mutex);
397 397
398 /* cancel the current workq request */ 398 /* cancel the current workq request */
399 edac_device_workq_teardown(edac_dev); 399 edac_device_workq_teardown(edac_dev);
@@ -401,7 +401,7 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
401 /* restart the workq request, with new delay value */ 401 /* restart the workq request, with new delay value */
402 edac_device_workq_setup(edac_dev, value); 402 edac_device_workq_setup(edac_dev, value);
403 403
404 up(&device_ctls_mutex); 404 mutex_unlock(&device_ctls_mutex);
405} 405}
406 406
407/** 407/**
@@ -425,7 +425,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
425 if (edac_debug_level >= 3) 425 if (edac_debug_level >= 3)
426 edac_device_dump_device(edac_dev); 426 edac_device_dump_device(edac_dev);
427#endif 427#endif
428 down(&device_ctls_mutex); 428 mutex_lock(&device_ctls_mutex);
429 429
430 if (add_edac_dev_to_global_list(edac_dev)) 430 if (add_edac_dev_to_global_list(edac_dev))
431 goto fail0; 431 goto fail0;
@@ -463,7 +463,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
463 dev_name(edac_dev), 463 dev_name(edac_dev),
464 edac_op_state_to_string(edac_dev->op_state)); 464 edac_op_state_to_string(edac_dev->op_state));
465 465
466 up(&device_ctls_mutex); 466 mutex_unlock(&device_ctls_mutex);
467 return 0; 467 return 0;
468 468
469fail1: 469fail1:
@@ -471,7 +471,7 @@ fail1:
471 del_edac_device_from_global_list(edac_dev); 471 del_edac_device_from_global_list(edac_dev);
472 472
473fail0: 473fail0:
474 up(&device_ctls_mutex); 474 mutex_unlock(&device_ctls_mutex);
475 return 1; 475 return 1;
476} 476}
477EXPORT_SYMBOL_GPL(edac_device_add_device); 477EXPORT_SYMBOL_GPL(edac_device_add_device);
@@ -495,12 +495,12 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
495 495
496 debugf0("MC: %s()\n", __func__); 496 debugf0("MC: %s()\n", __func__);
497 497
498 down(&device_ctls_mutex); 498 mutex_lock(&device_ctls_mutex);
499 499
500 /* Find the structure on the list, if not there, then leave */ 500 /* Find the structure on the list, if not there, then leave */
501 edac_dev = find_edac_device_by_dev(dev); 501 edac_dev = find_edac_device_by_dev(dev);
502 if (edac_dev == NULL) { 502 if (edac_dev == NULL) {
503 up(&device_ctls_mutex); 503 mutex_unlock(&device_ctls_mutex);
504 return NULL; 504 return NULL;
505 } 505 }
506 506
@@ -516,7 +516,7 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
516 /* deregister from global list */ 516 /* deregister from global list */
517 del_edac_device_from_global_list(edac_dev); 517 del_edac_device_from_global_list(edac_dev);
518 518
519 up(&device_ctls_mutex); 519 mutex_unlock(&device_ctls_mutex);
520 520
521 edac_printk(KERN_INFO, EDAC_MC, 521 edac_printk(KERN_INFO, EDAC_MC,
522 "Removed device %d for %s %s: DEV %s\n", 522 "Removed device %d for %s %s: DEV %s\n",