Commit e8aac4a9 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] i2c: i2c-i801 PEC code cleanups

The tests leading to the use of hardware PEC in the i2c-i801 driver
can be simplified.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 585b3160
...@@ -388,7 +388,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, ...@@ -388,7 +388,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
goto END; goto END;
} }
if (hwpec && command == I2C_SMBUS_BLOCK_DATA) { if (hwpec) {
/* wait for INTR bit as advised by Intel */ /* wait for INTR bit as advised by Intel */
timeout = 0; timeout = 0;
do { do {
...@@ -416,12 +416,13 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, ...@@ -416,12 +416,13 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
unsigned short flags, char read_write, u8 command, unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data * data) int size, union i2c_smbus_data * data)
{ {
int hwpec = 0; int hwpec;
int block = 0; int block = 0;
int ret, xact = 0; int ret, xact = 0;
if(isich4) hwpec = isich4 && (flags & I2C_CLIENT_PEC)
hwpec = (flags & I2C_CLIENT_PEC) != 0; && size != I2C_SMBUS_QUICK
&& size != I2C_SMBUS_I2C_BLOCK_DATA;
switch (size) { switch (size) {
case I2C_SMBUS_QUICK: case I2C_SMBUS_QUICK:
...@@ -467,11 +468,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, ...@@ -467,11 +468,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
return -1; return -1;
} }
if(isich4 && hwpec) { if (hwpec)
if(size != I2C_SMBUS_QUICK && outb_p(1, SMBAUXCTL); /* enable hardware PEC */
size != I2C_SMBUS_I2C_BLOCK_DATA)
outb_p(1, SMBAUXCTL); /* enable HW PEC */
}
if(block) if(block)
ret = i801_block_transaction(data, read_write, size, hwpec); ret = i801_block_transaction(data, read_write, size, hwpec);
else { else {
...@@ -479,11 +478,8 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, ...@@ -479,11 +478,8 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
ret = i801_transaction(); ret = i801_transaction();
} }
if(isich4 && hwpec) { if (hwpec)
if(size != I2C_SMBUS_QUICK && outb_p(0, SMBAUXCTL); /* disable hardware PEC */
size != I2C_SMBUS_I2C_BLOCK_DATA)
outb_p(0, SMBAUXCTL);
}
if(block) if(block)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment