diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-10-24 12:16:57 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2010-10-24 12:16:57 -0400 |
commit | 97cc4d49cfcda1c2dad89c00b62a25b628ce2115 (patch) | |
tree | 1c9120a9e5db76df3f82338c64a2a19d88aedcbc /include | |
parent | d582963a027fd63f8dfc97a0bf3654d4380e34ce (diff) |
i2c: Let i2c_parent_is_i2c_adapter return the parent adapter
This makes the calling site's code clearer IMHO.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Michael Lawnick <ml.lawnick@gmx.de>
Diffstat (limited to 'include')
-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 */ |