[i2c] [PATCH 1 of 2] Clean up of i2c-nforce2
Jean Delvare
khali at linux-fr.org
Mon Oct 8 19:50:28 CEST 2007
Hi Oleg,
This second version of the patch looks OK to me, except:
On Sun, 7 Oct 2007 02:29:34 -0400, Oleg Ryjkov wrote:
> +static int nforce2_check_status(struct i2c_adapter *adap)
> +{
> + struct nforce2_smbus *smbus = adap->algo_data;
> + int timeout = 0;
> + unsigned char temp;
> +
> + do {
> + msleep(1);
> + temp = inb_p(NVIDIA_SMB_STS);
> + } while ((!temp) && (timeout++ < MAX_TIMEOUT));
> +
> + if (timeout >= MAX_TIMEOUT) {
> + dev_dbg(&adap->dev, "SMBus Timeout (0x%02x)!\n", temp);
> + return -1;
> + }
If the timeout occurs, this means by definition that temp is 0, so
there's no point in printing its value in the debug message.
> + if (!(temp & NVIDIA_SMB_STS_DONE) || (temp & NVIDIA_SMB_STS_STATUS)) {
> + dev_dbg(&adap->dev, "Transaction failed (0x%02x)!\n", temp);
> + return -1;
> + }
> + return 0;
> +}
No need to resend the patch, I'll fix it myself if this is fine with
you.
Thanks,
--
Jean Delvare
More information about the i2c
mailing list