aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-11-15 18:23:25 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:26 -0500
commit2c45688faed1b19583c388694025e39001b68c8d (patch)
tree38555f579fbdf6c9d74899482abc754d1793c8d4 /drivers/infiniband
parent727792da2bc22e2ce125faef84aeca3b3e2f4a90 (diff)
IB/ipath: Convert ipath_eep_sem semaphore to a mutex
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Michael Albaugh <Michael.Albaugh@qlogic.com> Tested-by: Arthur Jones <arthur.jones@qlogic.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_eeprom.c20
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h3
3 files changed, 13 insertions, 12 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c
index e7c25dbbcdc9..a5b6299ed667 100644
--- a/drivers/infiniband/hw/ipath/ipath_eeprom.c
+++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c
@@ -510,10 +510,10 @@ int ipath_eeprom_read(struct ipath_devdata *dd, u8 eeprom_offset,
510{ 510{
511 int ret; 511 int ret;
512 512
513 ret = down_interruptible(&dd->ipath_eep_sem); 513 ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
514 if (!ret) { 514 if (!ret) {
515 ret = ipath_eeprom_internal_read(dd, eeprom_offset, buff, len); 515 ret = ipath_eeprom_internal_read(dd, eeprom_offset, buff, len);
516 up(&dd->ipath_eep_sem); 516 mutex_unlock(&dd->ipath_eep_lock);
517 } 517 }
518 518
519 return ret; 519 return ret;
@@ -524,10 +524,10 @@ int ipath_eeprom_write(struct ipath_devdata *dd, u8 eeprom_offset,
524{ 524{
525 int ret; 525 int ret;
526 526
527 ret = down_interruptible(&dd->ipath_eep_sem); 527 ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
528 if (!ret) { 528 if (!ret) {
529 ret = ipath_eeprom_internal_write(dd, eeprom_offset, buff, len); 529 ret = ipath_eeprom_internal_write(dd, eeprom_offset, buff, len);
530 up(&dd->ipath_eep_sem); 530 mutex_unlock(&dd->ipath_eep_lock);
531 } 531 }
532 532
533 return ret; 533 return ret;
@@ -616,9 +616,9 @@ void ipath_get_eeprom_info(struct ipath_devdata *dd)
616 goto bail; 616 goto bail;
617 } 617 }
618 618
619 down(&dd->ipath_eep_sem); 619 mutex_lock(&dd->ipath_eep_lock);
620 eep_stat = ipath_eeprom_internal_read(dd, 0, buf, len); 620 eep_stat = ipath_eeprom_internal_read(dd, 0, buf, len);
621 up(&dd->ipath_eep_sem); 621 mutex_unlock(&dd->ipath_eep_lock);
622 622
623 if (eep_stat) { 623 if (eep_stat) {
624 ipath_dev_err(dd, "Failed reading GUID from eeprom\n"); 624 ipath_dev_err(dd, "Failed reading GUID from eeprom\n");
@@ -764,14 +764,14 @@ int ipath_update_eeprom_log(struct ipath_devdata *dd)
764 /* Grab semaphore and read current EEPROM. If we get an 764 /* Grab semaphore and read current EEPROM. If we get an
765 * error, let go, but if not, keep it until we finish write. 765 * error, let go, but if not, keep it until we finish write.
766 */ 766 */
767 ret = down_interruptible(&dd->ipath_eep_sem); 767 ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
768 if (ret) { 768 if (ret) {
769 ipath_dev_err(dd, "Unable to acquire EEPROM for logging\n"); 769 ipath_dev_err(dd, "Unable to acquire EEPROM for logging\n");
770 goto free_bail; 770 goto free_bail;
771 } 771 }
772 ret = ipath_eeprom_internal_read(dd, 0, buf, len); 772 ret = ipath_eeprom_internal_read(dd, 0, buf, len);
773 if (ret) { 773 if (ret) {
774 up(&dd->ipath_eep_sem); 774 mutex_unlock(&dd->ipath_eep_lock);
775 ipath_dev_err(dd, "Unable read EEPROM for logging\n"); 775 ipath_dev_err(dd, "Unable read EEPROM for logging\n");
776 goto free_bail; 776 goto free_bail;
777 } 777 }
@@ -779,7 +779,7 @@ int ipath_update_eeprom_log(struct ipath_devdata *dd)
779 779
780 csum = flash_csum(ifp, 0); 780 csum = flash_csum(ifp, 0);
781 if (csum != ifp->if_csum) { 781 if (csum != ifp->if_csum) {
782 up(&dd->ipath_eep_sem); 782 mutex_unlock(&dd->ipath_eep_lock);
783 ipath_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", 783 ipath_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n",
784 csum, ifp->if_csum); 784 csum, ifp->if_csum);
785 ret = 1; 785 ret = 1;
@@ -849,7 +849,7 @@ int ipath_update_eeprom_log(struct ipath_devdata *dd)
849 csum = flash_csum(ifp, 1); 849 csum = flash_csum(ifp, 1);
850 ret = ipath_eeprom_internal_write(dd, 0, buf, hi_water + 1); 850 ret = ipath_eeprom_internal_write(dd, 0, buf, hi_water + 1);
851 } 851 }
852 up(&dd->ipath_eep_sem); 852 mutex_unlock(&dd->ipath_eep_lock);
853 if (ret) 853 if (ret)
854 ipath_dev_err(dd, "Failed updating EEPROM\n"); 854 ipath_dev_err(dd, "Failed updating EEPROM\n");
855 855
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 9dd0bacf8461..9e9d6fafcf0d 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -348,7 +348,7 @@ static int init_chip_first(struct ipath_devdata *dd,
348 348
349 spin_lock_init(&dd->ipath_gpio_lock); 349 spin_lock_init(&dd->ipath_gpio_lock);
350 spin_lock_init(&dd->ipath_eep_st_lock); 350 spin_lock_init(&dd->ipath_eep_st_lock);
351 sema_init(&dd->ipath_eep_sem, 1); 351 mutex_init(&dd->ipath_eep_lock);
352 352
353done: 353done:
354 *pdp = pd; 354 *pdp = pd;
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index bb1dc075f1d1..1ef82d6bf377 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -41,6 +41,7 @@
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/mutex.h>
44#include <asm/io.h> 45#include <asm/io.h>
45#include <rdma/ib_verbs.h> 46#include <rdma/ib_verbs.h>
46 47
@@ -616,7 +617,7 @@ struct ipath_devdata {
616 /* control access to actual counters, timer */ 617 /* control access to actual counters, timer */
617 spinlock_t ipath_eep_st_lock; 618 spinlock_t ipath_eep_st_lock;
618 /* control high-level access to EEPROM */ 619 /* control high-level access to EEPROM */
619 struct semaphore ipath_eep_sem; 620 struct mutex ipath_eep_lock;
620 /* Below inc'd by ipath_snap_cntrs(), locked by ipath_eep_st_lock */ 621 /* Below inc'd by ipath_snap_cntrs(), locked by ipath_eep_st_lock */
621 uint64_t ipath_traffic_wds; 622 uint64_t ipath_traffic_wds;
622 /* active time is kept in seconds, but logged in hours */ 623 /* active time is kept in seconds, but logged in hours */