[DeviceDriver] Remove i2c_core_lock.

This commit is contained in:
bernard 2014-11-01 16:38:53 +08:00
parent ecbde6bb9d
commit 6281ab2bbe
1 changed files with 2 additions and 9 deletions

View File

@ -24,8 +24,6 @@
#include <rtdevice.h> #include <rtdevice.h>
static struct rt_mutex i2c_core_lock;
rt_err_t rt_i2c_bus_device_register(struct rt_i2c_bus_device *bus, rt_err_t rt_i2c_bus_device_register(struct rt_i2c_bus_device *bus,
const char *bus_name) const char *bus_name)
{ {
@ -33,17 +31,12 @@ rt_err_t rt_i2c_bus_device_register(struct rt_i2c_bus_device *bus,
rt_mutex_init(&bus->lock, "i2c_bus_lock", RT_IPC_FLAG_FIFO); rt_mutex_init(&bus->lock, "i2c_bus_lock", RT_IPC_FLAG_FIFO);
rt_mutex_take(&i2c_core_lock, RT_WAITING_FOREVER); if (bus->timeout == 0) bus->timeout = RT_TICK_PER_SECOND;
if (bus->timeout == 0)
bus->timeout = RT_TICK_PER_SECOND;
res = rt_i2c_bus_device_device_init(bus, bus_name); res = rt_i2c_bus_device_device_init(bus, bus_name);
i2c_dbg("I2C bus [%s] registered\n", bus_name); i2c_dbg("I2C bus [%s] registered\n", bus_name);
rt_mutex_release(&i2c_core_lock);
return res; return res;
} }
@ -136,6 +129,6 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus,
int rt_i2c_core_init(void) int rt_i2c_core_init(void)
{ {
return rt_mutex_init(&i2c_core_lock, "i2c_core_lock", RT_IPC_FLAG_FIFO); return 0;
} }
INIT_COMPONENT_EXPORT(rt_i2c_core_init); INIT_COMPONENT_EXPORT(rt_i2c_core_init);