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>
+ mutex_lock(&dev->lock);
rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
if (!rc)
rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
if (!rc)
pr_debug("i2o: claim of device %d failed %d\n",
dev->lct_data.tid, rc);
pr_debug("i2o: claim of device %d failed %d\n",
dev->lct_data.tid, rc);
+ mutex_unlock(&dev->lock);
+ mutex_lock(&dev->lock);
/*
* If the controller takes a nonblocking approach to
/*
* If the controller takes a nonblocking approach to
pr_debug("i2o: claim release of device %d failed %d\n",
dev->lct_data.tid, rc);
pr_debug("i2o: claim release of device %d failed %d\n",
dev->lct_data.tid, rc);
+ mutex_unlock(&dev->lock);
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&dev->list);
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&dev->list);
- init_MUTEX(&dev->lock);
+ mutex_init(&dev->lock);
dev->device.bus = &i2o_bus_type;
dev->device.release = &i2o_device_release;
dev->device.bus = &i2o_bus_type;
dev->device.release = &i2o_device_release;
+ mutex_lock(&c->lct_lock);
lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL);
if (!lct) {
lct = c->lct = kmalloc(table_size * 4, GFP_KERNEL);
if (!lct) {
+ mutex_unlock(&c->lct_lock);
i2o_device_remove(dev);
}
i2o_device_remove(dev);
}
+ mutex_unlock(&c->lct_lock);
struct device *dev;
struct i2o_message *msg;
struct device *dev;
struct i2o_message *msg;
+ mutex_lock(&c->lct_lock);
+ mutex_unlock(&c->lct_lock);
INIT_LIST_HEAD(&c->devices);
spin_lock_init(&c->lock);
INIT_LIST_HEAD(&c->devices);
spin_lock_init(&c->lock);
- init_MUTEX(&c->lct_lock);
+ mutex_init(&c->lct_lock);
device_initialize(&c->device);
device_initialize(&c->device);
#include <linux/slab.h>
#include <linux/workqueue.h> /* work_struct */
#include <linux/mempool.h>
#include <linux/slab.h>
#include <linux/workqueue.h> /* work_struct */
#include <linux/mempool.h>
+#include <linux/mutex.h>
#include <asm/io.h>
#include <asm/semaphore.h> /* Needed for MUTEX init macros */
#include <asm/io.h>
#include <asm/semaphore.h> /* Needed for MUTEX init macros */
- struct semaphore lock; /* device lock */
+ struct mutex lock; /* device lock */
struct i2o_dma hrt; /* HW Resource Table */
i2o_lct *lct; /* Logical Config Table */
struct i2o_dma dlct; /* Temp LCT */
struct i2o_dma hrt; /* HW Resource Table */
i2o_lct *lct; /* Logical Config Table */
struct i2o_dma dlct; /* Temp LCT */
- struct semaphore lct_lock; /* Lock for LCT updates */
+ struct mutex lct_lock; /* Lock for LCT updates */
struct i2o_dma status_block; /* IOP status block */
struct i2o_io base; /* controller messaging unit */
struct i2o_dma status_block; /* IOP status block */
struct i2o_io base; /* controller messaging unit */