diff options
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 9391a491501a..1f66fa06a97c 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -384,10 +384,15 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
384 | dev_set_drvdata(&dev->dev, data); | 384 | dev_set_drvdata(&dev->dev, data); |
385 | } | 385 | } |
386 | 386 | ||
387 | static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) | 387 | static inline struct i2c_adapter * |
388 | i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) | ||
388 | { | 389 | { |
389 | return adapter->dev.parent != NULL | 390 | struct device *parent = adapter->dev.parent; |
390 | && adapter->dev.parent->type == &i2c_adapter_type; | 391 | |
392 | if (parent != NULL && parent->type == &i2c_adapter_type) | ||
393 | return to_i2c_adapter(parent); | ||
394 | else | ||
395 | return NULL; | ||
391 | } | 396 | } |
392 | 397 | ||
393 | /* Adapter locking functions, exported for shared pin cases */ | 398 | /* Adapter locking functions, exported for shared pin cases */ |