[PATCH 1/6] i2c: provide i2c_adapter_dev()

Bartosz Golaszewski posted 6 patches 1 month, 2 weeks ago
[PATCH 1/6] i2c: provide i2c_adapter_dev()
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
Provide a wrapper around the dereferencing of i2c_adapter::dev. Once we
convert i2c drivers to using it, it will be possible to finally move the
embedded struct device into a separate, revocable structure protected by
SRCU.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 include/linux/i2c.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 20fd41b51d5c85ee1665395c07345faafd8e2fca..b5f4db9417aca2e058c8be19d57d693339b6f9b9 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -768,6 +768,11 @@ struct i2c_adapter {
 };
 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
 
+static inline struct device *i2c_adapter_dev(struct i2c_adapter *adap)
+{
+	return &adap->dev;
+}
+
 static inline void *i2c_get_adapdata(const struct i2c_adapter *adap)
 {
 	return dev_get_drvdata(&adap->dev);

-- 
2.47.3