diff mbox

i2c-mux: Inherit retry count from parent controller for muxed bus.

Message ID 1386499701-5522-2-git-send-email-eliedebrauwer@gmail.com
State Superseded
Headers show

Commit Message

Elie De Brauwer Dec. 8, 2013, 10:48 a.m. UTC
Today if a mux i2c bus gets created the default retry count 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
which gets applied and used while the muxed bus (using the same
controller) has a default retry count of zero. This can be solved
by initializing the retry count of the muxed bus by the retry count
of the parent at creation time.

Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
---
 drivers/i2c/i2c-mux.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Wolfram Sang Dec. 9, 2013, 11:08 a.m. UTC | #1
On Sun, Dec 08, 2013 at 11:48:20AM +0100, Elie De Brauwer wrote:
> Today if a mux i2c bus gets created the default retry count 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
> which gets applied and used while the muxed bus (using the same
> controller) has a default retry count of zero. This can be solved
> by initializing the retry count of the muxed bus by the retry count
> of the parent at creation time.
> 
> Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>

Makes sense. Have you checked the timeout value, too?
Elie De Brauwer Dec. 9, 2013, 11:26 a.m. UTC | #2
On Mon, Dec 9, 2013 at 12:08 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> On Sun, Dec 08, 2013 at 11:48:20AM +0100, Elie De Brauwer wrote:
>> Today if a mux i2c bus gets created the default retry count 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
>> which gets applied and used while the muxed bus (using the same
>> controller) has a default retry count of zero. This can be solved
>> by initializing the retry count of the muxed bus by the retry count
>> of the parent at creation time.
>>
>> Signed-off-by: Elie De Brauwer <eliedebrauwer@gmail.com>
>
> Makes sense. Have you checked the timeout value, too?
>

Point taken, I hadn't bumped into this since i2c_add_mux_adapter() calls
i2c_add_adapter() which essentially sets is to 1 second if it is zero. But
it makes sense indeed to also use this value from the parent. I'll post an
updated version later today.

Thanks
E.
diff mbox

Patch

diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 797e311..1f879d8 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -139,6 +139,7 @@  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;
 
 	/* Sanity check on class */
 	if (i2c_mux_parent_classes(parent) & class)