提交 8fcfef6e 编写于 作者: J Jean Delvare

i2c: Set a default timeout value for all adapters

Setting a default timeout value on a per-algo basis doesn't make any
sense. Move the default value setting to i2c-core. Individual adapter
drivers can specify a different (non-zero) value if they wish.

Also express the timeout value in a way which results in the same
duration regarless of the value of HZ.
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Acked-by: NWolfram Sang <w.sang@pengutronix.de>
上级 154d22b0
...@@ -604,9 +604,7 @@ static int i2c_bit_prepare_bus(struct i2c_adapter *adap) ...@@ -604,9 +604,7 @@ static int i2c_bit_prepare_bus(struct i2c_adapter *adap)
/* register new adapter to i2c module... */ /* register new adapter to i2c module... */
adap->algo = &i2c_bit_algo; adap->algo = &i2c_bit_algo;
adap->retries = 3;
adap->timeout = 100; /* default values, should */
adap->retries = 3; /* be replaced by defines */
return 0; return 0;
} }
......
...@@ -423,7 +423,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) ...@@ -423,7 +423,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
/* register new adapter to i2c module... */ /* register new adapter to i2c module... */
adap->algo = &pcf_algo; adap->algo = &pcf_algo;
adap->timeout = 100;
if ((rval = pcf_init_8584(pcf_adap))) if ((rval = pcf_init_8584(pcf_adap)))
return rval; return rval;
......
...@@ -459,6 +459,11 @@ static int i2c_register_adapter(struct i2c_adapter *adap) ...@@ -459,6 +459,11 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
pr_debug("I2C adapter driver [%s] forgot to specify " pr_debug("I2C adapter driver [%s] forgot to specify "
"physical device\n", adap->name); "physical device\n", adap->name);
} }
/* Set default timeout to 1 second if not already set */
if (adap->timeout == 0)
adap->timeout = HZ;
dev_set_name(&adap->dev, "i2c-%d", adap->nr); dev_set_name(&adap->dev, "i2c-%d", adap->nr);
adap->dev.release = &i2c_adapter_dev_release; adap->dev.release = &i2c_adapter_dev_release;
adap->dev.class = &i2c_adapter_class; adap->dev.class = &i2c_adapter_class;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册