From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean Delvare Subject: Re: [PATCH] sfc: I2C adapter initialisation fixes Date: Wed, 18 Jun 2008 13:07:54 +0200 Message-ID: <20080618130754.6012351d@hyperion.delvare> References: <20080609182509.GJ11300@solarflare.com> <485885A7.5060409@pobox.com> <20080618105839.GL5350@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Jeff Garzik , netdev@vger.kernel.org, linux-net-drivers@solarflare.com To: Ben Hutchings Return-path: Received: from zone0.gcu-squad.org ([212.85.147.21]:12519 "EHLO services.gcu-squad.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbYFRLIE (ORCPT ); Wed, 18 Jun 2008 07:08:04 -0400 In-Reply-To: <20080618105839.GL5350@solarflare.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 18 Jun 2008 11:58:41 +0100, Ben Hutchings wrote: > 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 > diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c > index 630406e..9138ee5 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 = { > .getsda = falcon_getsda, > .getscl = falcon_getscl, > .udelay = 5, > - /* > - * This is the number of system clock ticks after which > - * 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, > + /* Wait up to 50 ms for slave to let us pull SCL high */ > + .timeout = DIV_ROUND_UP(HZ, 20), > }; > > /************************************************************************** > @@ -2479,12 +2474,11 @@ int falcon_probe_nic(struct efx_nic *efx) > > /* Initialise I2C adapter */ > 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.data = efx; > efx->i2c_adap.algo_data = &nic_data->i2c_data; > 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); > if (rc) > goto fail5; > --- > > I've corrected the comment about what timeout means. Thanks Ben. Acked-by: Jean Delvare (Technically speaking, high is the natural state of SCL, so it's pulled down and released up - but that's nitpicking.) -- Jean Delvare