aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-07-16 02:39:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:41 -0400
commit9ac162521cd9796f44d263a61090634844c719a6 (patch)
tree5988aba4299002ea4a425f747a275d29cb9dd3c5
parent1c6b4aa94576eee6dec3b8011f60d7f666db90b0 (diff)
Use mutexes instead of semaphores in I2O driver
The I2O driver uses two semaphores as mutexes. Use the mutex API instead of the (binary) semaphores. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/message/i2o/device.c16
-rw-r--r--drivers/message/i2o/exec-osm.c4
-rw-r--r--drivers/message/i2o/iop.c2
-rw-r--r--include/linux/i2o.h5
4 files changed, 14 insertions, 13 deletions
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index 611adc3c0f74..489d7c5c4965 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -62,7 +62,7 @@ int i2o_device_claim(struct i2o_device *dev)
62{ 62{
63 int rc = 0; 63 int rc = 0;
64 64
65 down(&dev->lock); 65 mutex_lock(&dev->lock);
66 66
67 rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY); 67 rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
68 if (!rc) 68 if (!rc)
@@ -72,7 +72,7 @@ int i2o_device_claim(struct i2o_device *dev)
72 pr_debug("i2o: claim of device %d failed %d\n", 72 pr_debug("i2o: claim of device %d failed %d\n",
73 dev->lct_data.tid, rc); 73 dev->lct_data.tid, rc);
74 74
75 up(&dev->lock); 75 mutex_unlock(&dev->lock);
76 76
77 return rc; 77 return rc;
78} 78}
@@ -96,7 +96,7 @@ int i2o_device_claim_release(struct i2o_device *dev)
96 int tries; 96 int tries;
97 int rc = 0; 97 int rc = 0;
98 98
99 down(&dev->lock); 99 mutex_lock(&dev->lock);
100 100
101 /* 101 /*
102 * If the controller takes a nonblocking approach to 102 * If the controller takes a nonblocking approach to
@@ -118,7 +118,7 @@ int i2o_device_claim_release(struct i2o_device *dev)
118 pr_debug("i2o: claim release of device %d failed %d\n", 118 pr_debug("i2o: claim release of device %d failed %d\n",
119 dev->lct_data.tid, rc); 119 dev->lct_data.tid, rc);
120 120
121 up(&dev->lock); 121 mutex_unlock(&dev->lock);
122 122
123 return rc; 123 return rc;
124} 124}
@@ -198,7 +198,7 @@ static struct i2o_device *i2o_device_alloc(void)
198 return ERR_PTR(-ENOMEM); 198 return ERR_PTR(-ENOMEM);
199 199
200 INIT_LIST_HEAD(&dev->list); 200 INIT_LIST_HEAD(&dev->list);
201 init_MUTEX(&dev->lock); 201 mutex_init(&dev->lock);
202 202
203 dev->device.bus = &i2o_bus_type; 203 dev->device.bus = &i2o_bus_type;
204 dev->device.release = &i2o_device_release; 204 dev->device.release = &i2o_device_release;
@@ -326,7 +326,7 @@ int i2o_device_parse_lct(struct i2o_controller *c)
326 u16 table_size; 326 u16 table_size;
327 u32 buf; 327 u32 buf;
328 328
329 down(&c->lct_lock); 329 mutex_lock(&c->lct_lock);
330 330
331 kfree(c->lct); 331 kfree(c->lct);
332 332
@@ -335,7 +335,7 @@ int i2o_device_parse_lct(struct i2o_controller *c)
335 335
336 lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL); 336 lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL);
337 if (!lct) { 337 if (!lct) {
338 up(&c->lct_lock); 338 mutex_unlock(&c->lct_lock);
339 return -ENOMEM; 339 return -ENOMEM;
340 } 340 }
341 341
@@ -408,7 +408,7 @@ int i2o_device_parse_lct(struct i2o_controller *c)
408 i2o_device_remove(dev); 408 i2o_device_remove(dev);
409 } 409 }
410 410
411 up(&c->lct_lock); 411 mutex_unlock(&c->lct_lock);
412 412
413 return 0; 413 return 0;
414} 414}
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 5278aad92bc4..c13b9321e7ab 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -537,7 +537,7 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
537 struct device *dev; 537 struct device *dev;
538 struct i2o_message *msg; 538 struct i2o_message *msg;
539 539
540 down(&c->lct_lock); 540 mutex_lock(&c->lct_lock);
541 541
542 dev = &c->pdev->dev; 542 dev = &c->pdev->dev;
543 543
@@ -561,7 +561,7 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
561 561
562 i2o_msg_post(c, msg); 562 i2o_msg_post(c, msg);
563 563
564 up(&c->lct_lock); 564 mutex_unlock(&c->lct_lock);
565 565
566 return 0; 566 return 0;
567}; 567};
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 3305c12372a2..a1ec16a075c6 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -1067,7 +1067,7 @@ struct i2o_controller *i2o_iop_alloc(void)
1067 1067
1068 INIT_LIST_HEAD(&c->devices); 1068 INIT_LIST_HEAD(&c->devices);
1069 spin_lock_init(&c->lock); 1069 spin_lock_init(&c->lock);
1070 init_MUTEX(&c->lct_lock); 1070 mutex_init(&c->lct_lock);
1071 1071
1072 device_initialize(&c->device); 1072 device_initialize(&c->device);
1073 1073
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 52f53e2e70c3..333a370a3bdc 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -31,6 +31,7 @@
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/workqueue.h> /* work_struct */ 32#include <linux/workqueue.h> /* work_struct */
33#include <linux/mempool.h> 33#include <linux/mempool.h>
34#include <linux/mutex.h>
34 35
35#include <asm/io.h> 36#include <asm/io.h>
36#include <asm/semaphore.h> /* Needed for MUTEX init macros */ 37#include <asm/semaphore.h> /* Needed for MUTEX init macros */
@@ -425,7 +426,7 @@ struct i2o_device {
425 426
426 struct device device; 427 struct device device;
427 428
428 struct semaphore lock; /* device lock */ 429 struct mutex lock; /* device lock */
429}; 430};
430 431
431/* 432/*
@@ -544,7 +545,7 @@ struct i2o_controller {
544 struct i2o_dma hrt; /* HW Resource Table */ 545 struct i2o_dma hrt; /* HW Resource Table */
545 i2o_lct *lct; /* Logical Config Table */ 546 i2o_lct *lct; /* Logical Config Table */
546 struct i2o_dma dlct; /* Temp LCT */ 547 struct i2o_dma dlct; /* Temp LCT */
547 struct semaphore lct_lock; /* Lock for LCT updates */ 548 struct mutex lct_lock; /* Lock for LCT updates */
548 struct i2o_dma status_block; /* IOP status block */ 549 struct i2o_dma status_block; /* IOP status block */
549 550
550 struct i2o_io base; /* controller messaging unit */ 551 struct i2o_io base; /* controller messaging unit */