[i2c] [PATCH] i2c-pasemi: bugfixes

Jean Delvare khali at linux-fr.org
Tue Apr 17 07:57:34 CEST 2007


Hi Olof,

On Mon, 16 Apr 2007 00:50:22 -0500, Olof Johansson wrote:
> Minor bugfixes to i2c-pasemi:
> 
> * Last write during i2c_xfer is of the wrong byte (off-by-1).
> * Read length is wrong for some of the reads (mistakenly used the PEC
>   version)

Note that I had been asking about this in my last review of your driver!
http://lists.lm-sensors.org/pipermail/i2c/2007-February/000769.html

> 
> Signed-off-by: Olof Johansson <olof at lixom.net>
> 
> 
> ---
> Hi,
> 
> No real worry about these -- while they're real and quite bad bugs,
> we don't have any mainline users at this time. It'd be nice to get it
> in during the 2.6.22 merge window though.
> 
> Thanks,
> 
> Olof
> 
> Index: linux-2.6/drivers/i2c/busses/i2c-pasemi.c
> ===================================================================
> --- linux-2.6.orig/drivers/i2c/busses/i2c-pasemi.c
> +++ linux-2.6/drivers/i2c/busses/i2c-pasemi.c
> @@ -141,7 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2
>  		for (i = 0; i < msg->len - 1; i++)
>  			TXFIFO_WR(smbus, msg->buf[i]);
>  
> -		TXFIFO_WR(smbus, msg->buf[msg->len] |
> +		TXFIFO_WR(smbus, msg->buf[msg->len-1] |
>  			  (stop ? MTXFIFO_STOP : 0));
>  	}
>  
> @@ -226,7 +226,7 @@ static int pasemi_smb_xfer(struct i2c_ad
>  			rd = RXFIFO_RD(smbus);
>  			len = min_t(u8, (rd & MRXFIFO_DATA_M),
>  				    I2C_SMBUS_BLOCK_MAX);
> -			TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ |
> +			TXFIFO_WR(smbus, len | MTXFIFO_READ |
>  					 MTXFIFO_STOP);
>  		} else {
>  			len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX);
> @@ -258,7 +258,7 @@ static int pasemi_smb_xfer(struct i2c_ad
>  		rd = RXFIFO_RD(smbus);
>  		len = min_t(u8, (rd & MRXFIFO_DATA_M),
>  			    I2C_SMBUS_BLOCK_MAX - len);
> -		TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | MTXFIFO_STOP);
> +		TXFIFO_WR(smbus, len | MTXFIFO_READ | MTXFIFO_STOP);
>  		break;
>  
>  	default:

Patch applied, thanks.

-- 
Jean Delvare



More information about the i2c mailing list