fix SW PEC for read_byte_data
PATCH 1/1 fix SW PEC for read_byte_data
Index: kernel/i2c-core.c
=================================RCS file: /home/cvs/i2c/kernel/i2c-core.c,v retrieving revision 1.112
i2c-core.c +8 -4
@@ -998,7 +998,7 @@int i2c_smbus_check_pec (u16 addr,u8 command,int size,u8 partial,union i2c_smbus_data *data) { -u8 buf[3 ], rpec, cpec; +u8 buf[4 ], rpec, cpec; buf[1 ] = command;switch (size) {
@@ -1008,9 +1008,10 @@ rpec = data->byte;break ;case I2C_SMBUS_WORD_DATA : - buf[0 ] = (addr <<1 ) |1 ; - buf[2 ] = data->word &0xff ; - cpec =i2c_smbus_pec (3 , buf,NULL ); + buf[0 ] = addr <<1 ; + buf[2 ] = (addr <<1 ) |1 ; + buf[3 ] = data->word &0xff ; + cpec =i2c_smbus_pec (4 , buf,NULL ); rpec = data->word >>8 ;break ;case I2C_SMBUS_WORD_DATA_PEC :
@@ -1399,6 +1400,9 @@if (read_write =I2C_SMBUS_READ && size =I2C_SMBUS_BLOCK_DATA ) size =I2C_SMBUS_BLOCK_DATA_PEC ; +else if (read_write =I2C_SMBUS_READ && + size =I2C_SMBUS_BYTE_DATA ) + size =I2C_SMBUS_WORD_DATA ;else if (size =I2C_SMBUS_PROC_CALL ) size =I2C_SMBUS_PROC_CALL_PEC ;else if (size =I2C_SMBUS_BLOCK_PROC_CALL ) {
----
Hideki IWAMOTO [email protected]