Skip to content

Commit

Permalink
i2c: Re-instate body of i2c_parent_is_i2c_adapter()
Browse files Browse the repository at this point in the history
The body of i2c_parent_is_i2c_adapter() is currently guarded by
I2C_MUX. It should be CONFIG_I2C_MUX instead.

Among potentially other problems, this resulted in i2c_lock_adapter()
only locking I2C mux child adapters, and not the parent adapter. In
turn, this could allow inter-mingling of mux child selection and I2C
transactions, which could result in I2C transactions being directed to
the wrong I2C bus, and possibly even switching between busses in the
middle of a transaction.

One concrete issue caused by this bug was corrupted HDMI EDID reads
during boot on the NVIDIA Tegra Seaboard system, although this only
became apparent in recent linux-next, when the boot timing was changed
just enough to trigger the race condition.

Fixes: 3923172 ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
Cc: Phil Carmody <[email protected]>
Cc: <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
nvswarren authored and Wolfram Sang committed Jan 14, 2014
1 parent 7e22e91 commit 2fac2b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ 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)
#if IS_ENABLED(CONFIG_I2C_MUX)
struct device *parent = adapter->dev.parent;

if (parent != NULL && parent->type == &i2c_adapter_type)
Expand Down

0 comments on commit 2fac2b8

Please sign in to comment.