aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-07-19 04:49:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:53 -0400
commit63b7df9101895d1f0a259c567b3bab949a23075f (patch)
tree05a861b959abe5f254dd706995ce2a4ceb22c88a /drivers/edac/edac_mc.c
parent1a9b85e6b36cdd046b0a354c38af20a7155272b8 (diff)
drivers/edac: change from semaphore to mutex operation
The EDAC core code uses a semaphore as mutex. use the mutex API instead of the (binary) semaphore. Matthaias wrote this, but since I had some patches ahead of it, I need to modify it to follow my patches. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.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_mc.c')
-rw-r--r--drivers/edac/edac_mc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 1f22d8cad6f7..eae1ca1caebd 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -35,7 +35,7 @@
35 35
36 36
37/* lock to memory controller's control array */ 37/* lock to memory controller's control array */
38static DECLARE_MUTEX(mem_ctls_mutex); 38static DEFINE_MUTEX(mem_ctls_mutex);
39static struct list_head mc_devices = LIST_HEAD_INIT(mc_devices); 39static struct list_head mc_devices = LIST_HEAD_INIT(mc_devices);
40 40
41#ifdef CONFIG_EDAC_DEBUG 41#ifdef CONFIG_EDAC_DEBUG
@@ -334,7 +334,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
334 } 334 }
335 } 335 }
336#endif 336#endif
337 down(&mem_ctls_mutex); 337 mutex_lock(&mem_ctls_mutex);
338 338
339 if (add_mc_to_global_list(mci)) 339 if (add_mc_to_global_list(mci))
340 goto fail0; 340 goto fail0;
@@ -352,14 +352,14 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
352 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n", 352 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n",
353 mci->mod_name, mci->ctl_name, dev_name(mci->dev)); 353 mci->mod_name, mci->ctl_name, dev_name(mci->dev));
354 354
355 up(&mem_ctls_mutex); 355 mutex_unlock(&mem_ctls_mutex);
356 return 0; 356 return 0;
357 357
358fail1: 358fail1:
359 del_mc_from_global_list(mci); 359 del_mc_from_global_list(mci);
360 360
361fail0: 361fail0:
362 up(&mem_ctls_mutex); 362 mutex_unlock(&mem_ctls_mutex);
363 return 1; 363 return 1;
364} 364}
365EXPORT_SYMBOL_GPL(edac_mc_add_mc); 365EXPORT_SYMBOL_GPL(edac_mc_add_mc);
@@ -376,16 +376,16 @@ struct mem_ctl_info * edac_mc_del_mc(struct device *dev)
376 struct mem_ctl_info *mci; 376 struct mem_ctl_info *mci;
377 377
378 debugf0("MC: %s()\n", __func__); 378 debugf0("MC: %s()\n", __func__);
379 down(&mem_ctls_mutex); 379 mutex_lock(&mem_ctls_mutex);
380 380
381 if ((mci = find_mci_by_dev(dev)) == NULL) { 381 if ((mci = find_mci_by_dev(dev)) == NULL) {
382 up(&mem_ctls_mutex); 382 mutex_unlock(&mem_ctls_mutex);
383 return NULL; 383 return NULL;
384 } 384 }
385 385
386 edac_remove_sysfs_mci_device(mci); 386 edac_remove_sysfs_mci_device(mci);
387 del_mc_from_global_list(mci); 387 del_mc_from_global_list(mci);
388 up(&mem_ctls_mutex); 388 mutex_unlock(&mem_ctls_mutex);
389 edac_printk(KERN_INFO, EDAC_MC, 389 edac_printk(KERN_INFO, EDAC_MC,
390 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, 390 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx,
391 mci->mod_name, mci->ctl_name, dev_name(mci->dev)); 391 mci->mod_name, mci->ctl_name, dev_name(mci->dev));
@@ -722,7 +722,7 @@ void edac_check_mc_devices(void)
722 struct mem_ctl_info *mci; 722 struct mem_ctl_info *mci;
723 723
724 debugf3("%s()\n", __func__); 724 debugf3("%s()\n", __func__);
725 down(&mem_ctls_mutex); 725 mutex_lock(&mem_ctls_mutex);
726 726
727 list_for_each(item, &mc_devices) { 727 list_for_each(item, &mc_devices) {
728 mci = list_entry(item, struct mem_ctl_info, link); 728 mci = list_entry(item, struct mem_ctl_info, link);
@@ -731,5 +731,5 @@ void edac_check_mc_devices(void)
731 mci->edac_check(mci); 731 mci->edac_check(mci);
732 } 732 }
733 733
734 up(&mem_ctls_mutex); 734 mutex_unlock(&mem_ctls_mutex);
735} 735}