Commit 0ca84761faeb9d49301d45b39859411c7a124690

Authored by Doug Thompson
Committed by Linus Torvalds
1 parent 7f065e723b

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>

Showing 1 changed file with 11 additions and 11 deletions Side-by-side Diff

drivers/edac/edac_device.c
... ... @@ -33,7 +33,7 @@
33 33 #include "edac_module.h"
34 34  
35 35 /* lock to memory controller's control array 'edac_device_list' */
36   -static DECLARE_MUTEX(device_ctls_mutex);
  36 +static DEFINE_MUTEX(device_ctls_mutex);
37 37 static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list);
38 38  
39 39 #ifdef CONFIG_EDAC_DEBUG
... ... @@ -340,7 +340,7 @@
340 340 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
341 341  
342 342 //debugf0("%s() here and running\n", __func__);
343   - down(&device_ctls_mutex);
  343 + mutex_lock(&device_ctls_mutex);
344 344  
345 345 /* Only poll controllers that are running polled and have a check */
346 346 if ((edac_dev->op_state == OP_RUNNING_POLL) &&
... ... @@ -348,7 +348,7 @@
348 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 353 /* Reschedule */
354 354 queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay);
... ... @@ -393,7 +393,7 @@
393 393 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
394 394 unsigned long value)
395 395 {
396   - down(&device_ctls_mutex);
  396 + mutex_lock(&device_ctls_mutex);
397 397  
398 398 /* cancel the current workq request */
399 399 edac_device_workq_teardown(edac_dev);
... ... @@ -401,7 +401,7 @@
401 401 /* restart the workq request, with new delay value */
402 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 @@
425 425 if (edac_debug_level >= 3)
426 426 edac_device_dump_device(edac_dev);
427 427 #endif
428   - down(&device_ctls_mutex);
  428 + mutex_lock(&device_ctls_mutex);
429 429  
430 430 if (add_edac_dev_to_global_list(edac_dev))
431 431 goto fail0;
... ... @@ -463,7 +463,7 @@
463 463 dev_name(edac_dev),
464 464 edac_op_state_to_string(edac_dev->op_state));
465 465  
466   - up(&device_ctls_mutex);
  466 + mutex_unlock(&device_ctls_mutex);
467 467 return 0;
468 468  
469 469 fail1:
... ... @@ -471,7 +471,7 @@
471 471 del_edac_device_from_global_list(edac_dev);
472 472  
473 473 fail0:
474   - up(&device_ctls_mutex);
  474 + mutex_unlock(&device_ctls_mutex);
475 475 return 1;
476 476 }
477 477 EXPORT_SYMBOL_GPL(edac_device_add_device);
478 478  
... ... @@ -495,12 +495,12 @@
495 495  
496 496 debugf0("MC: %s()\n", __func__);
497 497  
498   - down(&device_ctls_mutex);
  498 + mutex_lock(&device_ctls_mutex);
499 499  
500 500 /* Find the structure on the list, if not there, then leave */
501 501 edac_dev = find_edac_device_by_dev(dev);
502 502 if (edac_dev == NULL) {
503   - up(&device_ctls_mutex);
  503 + mutex_unlock(&device_ctls_mutex);
504 504 return NULL;
505 505 }
506 506  
... ... @@ -516,7 +516,7 @@
516 516 /* deregister from global list */
517 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 521 edac_printk(KERN_INFO, EDAC_MC,
522 522 "Removed device %d for %s %s: DEV %s\n",