summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-01-11 10:50:26 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:21:49 -0800
commitb3585e4f5b3e4ddb4d82ae50d0b844f619c6d821 (patch)
tree5375363cc6087d74196efc0ded6dae9a8a4c2ad5 /drivers/i2c/i2c-core.c
parent2488a39d233a758d41ab7de70a220bc956f3c96c (diff)
downloadop-kernel-dev-b3585e4f5b3e4ddb4d82ae50d0b844f619c6d821.zip
op-kernel-dev-b3585e4f5b3e4ddb4d82ae50d0b844f619c6d821.tar.gz
[PATCH] I2C: Convert i2c to mutexes
The patch below converts a few i2c semaphores to mutexes Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 1a2c9ab..9733443 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -31,12 +31,13 @@
#include <linux/idr.h>
#include <linux/seq_file.h>
#include <linux/platform_device.h>
+#include <linux/mutex.h>
#include <asm/uaccess.h>
static LIST_HEAD(adapters);
static LIST_HEAD(drivers);
-static DECLARE_MUTEX(core_lists);
+static DEFINE_MUTEX(core_lists);
static DEFINE_IDR(i2c_adapter_idr);
/* match always succeeds, as we want the probe() to tell if we really accept this match */
@@ -153,7 +154,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
struct list_head *item;
struct i2c_driver *driver;
- down(&core_lists);
+ mutex_lock(&core_lists);
if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) {
res = -ENOMEM;
@@ -203,7 +204,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
}
out_unlock:
- up(&core_lists);
+ mutex_unlock(&core_lists);
return res;
}
@@ -216,7 +217,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
struct i2c_client *client;
int res = 0;
- down(&core_lists);
+ mutex_lock(&core_lists);
/* First make sure that this adapter was ever added */
list_for_each_entry(adap_from_list, &adapters, list) {
@@ -272,7 +273,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
out_unlock:
- up(&core_lists);
+ mutex_unlock(&core_lists);
return res;
}
@@ -289,7 +290,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
struct i2c_adapter *adapter;
int res = 0;
- down(&core_lists);
+ mutex_lock(&core_lists);
/* add the driver to the list of i2c drivers in the driver core */
driver->driver.owner = owner;
@@ -311,7 +312,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
}
out_unlock:
- up(&core_lists);
+ mutex_unlock(&core_lists);
return res;
}
EXPORT_SYMBOL(i2c_register_driver);
@@ -324,7 +325,7 @@ int i2c_del_driver(struct i2c_driver *driver)
int res = 0;
- down(&core_lists);
+ mutex_lock(&core_lists);
/* Have a look at each adapter, if clients of this driver are still
* attached. If so, detach them to be able to kill the driver
@@ -363,7 +364,7 @@ int i2c_del_driver(struct i2c_driver *driver)
pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
out_unlock:
- up(&core_lists);
+ mutex_unlock(&core_lists);
return 0;
}
@@ -779,12 +780,12 @@ struct i2c_adapter* i2c_get_adapter(int id)
{
struct i2c_adapter *adapter;
- down(&core_lists);
+ mutex_lock(&core_lists);
adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
if (adapter && !try_module_get(adapter->owner))
adapter = NULL;
- up(&core_lists);
+ mutex_unlock(&core_lists);
return adapter;
}
OpenPOWER on IntegriCloud