浏览代码

i2c: export i2c_adapter_depth()

For crazy setups in which an i2c gpio expander is behind an i2c gpio
multiplexer controlled by a gpio provided a second expander using the
same device driver we need to explicitly tell lockdep how to handle
nested locking.

Export i2c_adapter_depth() as public API to be reused outside of i2c
core code.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Peter Rosin <peda@axentia.se>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Bartosz Golaszewski 9 年之前
父节点
当前提交
8dd1fe1594
共有 2 个文件被更改,包括 3 次插入7 次删除
  1. 2 7
      drivers/i2c/i2c-core.c
  2. 1 0
      include/linux/i2c.h

+ 2 - 7
drivers/i2c/i2c-core.c

@@ -1426,13 +1426,7 @@ static void i2c_adapter_dev_release(struct device *dev)
 	complete(&adap->dev_released);
 	complete(&adap->dev_released);
 }
 }
 
 
-/*
- * This function is only needed for mutex_lock_nested, so it is never
- * called unless locking correctness checking is enabled. Thus we
- * make it inline to avoid a compiler warning. That's what gcc ends up
- * doing anyway.
- */
-static inline unsigned int i2c_adapter_depth(struct i2c_adapter *adapter)
+unsigned int i2c_adapter_depth(struct i2c_adapter *adapter)
 {
 {
 	unsigned int depth = 0;
 	unsigned int depth = 0;
 
 
@@ -1441,6 +1435,7 @@ static inline unsigned int i2c_adapter_depth(struct i2c_adapter *adapter)
 
 
 	return depth;
 	return depth;
 }
 }
+EXPORT_SYMBOL_GPL(i2c_adapter_depth);
 
 
 /*
 /*
  * Let users instantiate I2C devices through sysfs. This can be used when
  * Let users instantiate I2C devices through sysfs. This can be used when

+ 1 - 0
include/linux/i2c.h

@@ -698,6 +698,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
 
 
 extern struct i2c_adapter *i2c_get_adapter(int nr);
 extern struct i2c_adapter *i2c_get_adapter(int nr);
 extern void i2c_put_adapter(struct i2c_adapter *adap);
 extern void i2c_put_adapter(struct i2c_adapter *adap);
+extern unsigned int i2c_adapter_depth(struct i2c_adapter *adapter);
 
 
 void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults);
 void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults);