aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-07-18 13:59:12 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-22 19:43:29 -0400
commit9dadae686fce02a02982fc9c0563f6b917217a66 (patch)
treeafcae0c58a0e8eb927a7d80d412fdb41dc5b0dff /drivers/net/sfc
parent81250297d85b26eb4e9de5decf752dce430277f9 (diff)
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: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/falcon.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 630406e142e5..9138ee5b7b7b 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -223,13 +223,8 @@ static struct i2c_algo_bit_data falcon_i2c_bit_operations = {
223 .getsda = falcon_getsda, 223 .getsda = falcon_getsda,
224 .getscl = falcon_getscl, 224 .getscl = falcon_getscl,
225 .udelay = 5, 225 .udelay = 5,
226 /* 226 /* Wait up to 50 ms for slave to let us pull SCL high */
227 * This is the number of system clock ticks after which 227 .timeout = DIV_ROUND_UP(HZ, 20),
228 * i2c-algo-bit gives up waiting for SCL to become high.
229 * It must be at least 2 since the first tick can happen
230 * immediately after it starts waiting.
231 */
232 .timeout = 2,
233}; 228};
234 229
235/************************************************************************** 230/**************************************************************************
@@ -2479,12 +2474,11 @@ int falcon_probe_nic(struct efx_nic *efx)
2479 2474
2480 /* Initialise I2C adapter */ 2475 /* Initialise I2C adapter */
2481 efx->i2c_adap.owner = THIS_MODULE; 2476 efx->i2c_adap.owner = THIS_MODULE;
2482 efx->i2c_adap.class = I2C_CLASS_HWMON;
2483 nic_data->i2c_data = falcon_i2c_bit_operations; 2477 nic_data->i2c_data = falcon_i2c_bit_operations;
2484 nic_data->i2c_data.data = efx; 2478 nic_data->i2c_data.data = efx;
2485 efx->i2c_adap.algo_data = &nic_data->i2c_data; 2479 efx->i2c_adap.algo_data = &nic_data->i2c_data;
2486 efx->i2c_adap.dev.parent = &efx->pci_dev->dev; 2480 efx->i2c_adap.dev.parent = &efx->pci_dev->dev;
2487 strcpy(efx->i2c_adap.name, "SFC4000 GPIO"); 2481 strlcpy(efx->i2c_adap.name, "SFC4000 GPIO", sizeof(efx->i2c_adap.name));
2488 rc = i2c_bit_add_bus(&efx->i2c_adap); 2482 rc = i2c_bit_add_bus(&efx->i2c_adap);
2489 if (rc) 2483 if (rc)
2490 goto fail5; 2484 goto fail5;