@@ -187,6 +187,8 @@ struct clk;
struct device;
struct reset_control;
+struct i2c_dw_semaphore_callbacks;
+
/**
* struct dw_i2c_dev - private i2c-designware data
* @dev: driver model device node
@@ -291,7 +293,7 @@ struct dw_i2c_dev {
u16 hs_lcnt;
int (*acquire_lock)(void);
void (*release_lock)(void);
- int semaphore_idx;
+ const struct i2c_dw_semaphore_callbacks *semaphore_cb;
bool shared_with_punit;
void (*disable)(struct dw_i2c_dev *dev);
int (*init)(struct dw_i2c_dev *dev);
@@ -247,21 +247,18 @@ static void i2c_dw_remove_lock_support(void *data)
{
struct dw_i2c_dev *dev = data;
- if (dev->semaphore_idx < 0)
+ if (!dev->semaphore_cb)
return;
- if (i2c_dw_semaphore_cb_table[dev->semaphore_idx].remove)
- i2c_dw_semaphore_cb_table[dev->semaphore_idx].remove(dev);
+ if (dev->semaphore_cb->remove)
+ dev->semaphore_cb->remove(dev);
}
static int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
{
const struct i2c_dw_semaphore_callbacks *ptr;
- int i = 0;
int ret;
- dev->semaphore_idx = -1;
-
for (ptr = i2c_dw_semaphore_cb_table; ptr->probe; ptr++) {
ret = ptr->probe(dev);
if (ret) {
@@ -273,11 +270,10 @@ static int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
if (ret != -ENODEV)
return ret;
- i++;
continue;
}
- dev->semaphore_idx = i;
+ dev->semaphore_cb = ptr;
break;
}