Skip to content

Commit

Permalink
i2c: reduce parent checking to a NOOP in non-I2C_MUX case
Browse files Browse the repository at this point in the history
In 0826374 - i2c: Multiplexed I2C bus core support
core i2c code increased in size and complexity even when I2C_MUX
wasn't selected.

Turning this check into a constant NULL in the n case lets the
client functions in be simplified too, not needing to include
never-called calls to the mux-specific helpers.

Signed-off-by: Phil Carmody <phil.carmody@partner.samsung.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Phil Carmody authored and Wolfram Sang committed Aug 7, 2013
1 parent 8256424 commit 3923172
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,13 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
static inline struct i2c_adapter *
i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
{
#if IS_ENABLED(I2C_MUX)
struct device *parent = adapter->dev.parent;

if (parent != NULL && parent->type == &i2c_adapter_type)
return to_i2c_adapter(parent);
else
#endif
return NULL;
}

Expand Down

0 comments on commit 3923172

Please sign in to comment.