Skip to content

Commit

Permalink
i2c: mux: Inherit retry count and timeout from parent for muxed bus
Browse files Browse the repository at this point in the history
If a muxed i2c bus gets created the default retry count and
timeout of the muxed bus is zero. Hence it it possible that you
end up with a situation where the parent controller sets a default
retry count and timeout which gets applied and used while the muxed
bus (using the same controller) has a default retry count of zero
and a default timeout of 1s (set in i2c_add_adapter()). This can be
solved by initializing the retry count and timeout of the muxed
bus with the values used by the the parent at creation time.

Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Elie De Brauwer authored and Wolfram Sang committed Dec 12, 2013
1 parent 374b105 commit 2212a85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/i2c/i2c-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
priv->adap.algo = &priv->algo;
priv->adap.algo_data = priv;
priv->adap.dev.parent = &parent->dev;
priv->adap.retries = parent->retries;
priv->adap.timeout = parent->timeout;

/* Sanity check on class */
if (i2c_mux_parent_classes(parent) & class)
Expand Down

0 comments on commit 2212a85

Please sign in to comment.