提交 9dadae68 编写于 作者: B Ben Hutchings 提交者: Jeff Garzik

sfc: I2C adapter initialisation fixes

As recommended by Jean Delvare:
- Increase timeout to 50 ms
- Leave adapter class clear so that unwanted drivers do not probe our bus
- Use strlcpy() for name initialisation
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 81250297
...@@ -223,13 +223,8 @@ static struct i2c_algo_bit_data falcon_i2c_bit_operations = { ...@@ -223,13 +223,8 @@ static struct i2c_algo_bit_data falcon_i2c_bit_operations = {
.getsda = falcon_getsda, .getsda = falcon_getsda,
.getscl = falcon_getscl, .getscl = falcon_getscl,
.udelay = 5, .udelay = 5,
/* /* Wait up to 50 ms for slave to let us pull SCL high */
* This is the number of system clock ticks after which .timeout = DIV_ROUND_UP(HZ, 20),
* i2c-algo-bit gives up waiting for SCL to become high.
* It must be at least 2 since the first tick can happen
* immediately after it starts waiting.
*/
.timeout = 2,
}; };
/************************************************************************** /**************************************************************************
...@@ -2479,12 +2474,11 @@ int falcon_probe_nic(struct efx_nic *efx) ...@@ -2479,12 +2474,11 @@ int falcon_probe_nic(struct efx_nic *efx)
/* Initialise I2C adapter */ /* Initialise I2C adapter */
efx->i2c_adap.owner = THIS_MODULE; efx->i2c_adap.owner = THIS_MODULE;
efx->i2c_adap.class = I2C_CLASS_HWMON;
nic_data->i2c_data = falcon_i2c_bit_operations; nic_data->i2c_data = falcon_i2c_bit_operations;
nic_data->i2c_data.data = efx; nic_data->i2c_data.data = efx;
efx->i2c_adap.algo_data = &nic_data->i2c_data; efx->i2c_adap.algo_data = &nic_data->i2c_data;
efx->i2c_adap.dev.parent = &efx->pci_dev->dev; efx->i2c_adap.dev.parent = &efx->pci_dev->dev;
strcpy(efx->i2c_adap.name, "SFC4000 GPIO"); strlcpy(efx->i2c_adap.name, "SFC4000 GPIO", sizeof(efx->i2c_adap.name));
rc = i2c_bit_add_bus(&efx->i2c_adap); rc = i2c_bit_add_bus(&efx->i2c_adap);
if (rc) if (rc)
goto fail5; goto fail5;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册