diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-10-26 15:34:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 17:02:14 -0400 |
commit | e8aac4a9b417643dd9739b48473790a09b8b6cbe (patch) | |
tree | 70934ffa1a7327c62d13f09d0e1d8b74277b0a62 /drivers | |
parent | 585b3160f8212e58325bc1c0292c2ec01ac5db84 (diff) |
[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: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 27e7894a9d1c..4f63195069da 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -388,7 +388,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
388 | goto END; | 388 | goto END; |
389 | } | 389 | } |
390 | 390 | ||
391 | if (hwpec && command == I2C_SMBUS_BLOCK_DATA) { | 391 | if (hwpec) { |
392 | /* wait for INTR bit as advised by Intel */ | 392 | /* wait for INTR bit as advised by Intel */ |
393 | timeout = 0; | 393 | timeout = 0; |
394 | do { | 394 | do { |
@@ -416,12 +416,13 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
416 | unsigned short flags, char read_write, u8 command, | 416 | unsigned short flags, char read_write, u8 command, |
417 | int size, union i2c_smbus_data * data) | 417 | int size, union i2c_smbus_data * data) |
418 | { | 418 | { |
419 | int hwpec = 0; | 419 | int hwpec; |
420 | int block = 0; | 420 | int block = 0; |
421 | int ret, xact = 0; | 421 | int ret, xact = 0; |
422 | 422 | ||
423 | if(isich4) | 423 | hwpec = isich4 && (flags & I2C_CLIENT_PEC) |
424 | hwpec = (flags & I2C_CLIENT_PEC) != 0; | 424 | && size != I2C_SMBUS_QUICK |
425 | && size != I2C_SMBUS_I2C_BLOCK_DATA; | ||
425 | 426 | ||
426 | switch (size) { | 427 | switch (size) { |
427 | case I2C_SMBUS_QUICK: | 428 | case I2C_SMBUS_QUICK: |
@@ -467,11 +468,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
467 | return -1; | 468 | return -1; |
468 | } | 469 | } |
469 | 470 | ||
470 | if(isich4 && hwpec) { | 471 | if (hwpec) |
471 | if(size != I2C_SMBUS_QUICK && | 472 | outb_p(1, SMBAUXCTL); /* enable hardware PEC */ |
472 | size != I2C_SMBUS_I2C_BLOCK_DATA) | 473 | |
473 | outb_p(1, SMBAUXCTL); /* enable HW PEC */ | ||
474 | } | ||
475 | if(block) | 474 | if(block) |
476 | ret = i801_block_transaction(data, read_write, size, hwpec); | 475 | ret = i801_block_transaction(data, read_write, size, hwpec); |
477 | else { | 476 | else { |
@@ -479,11 +478,8 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
479 | ret = i801_transaction(); | 478 | ret = i801_transaction(); |
480 | } | 479 | } |
481 | 480 | ||
482 | if(isich4 && hwpec) { | 481 | if (hwpec) |
483 | if(size != I2C_SMBUS_QUICK && | 482 | outb_p(0, SMBAUXCTL); /* disable hardware PEC */ |
484 | size != I2C_SMBUS_I2C_BLOCK_DATA) | ||
485 | outb_p(0, SMBAUXCTL); | ||
486 | } | ||
487 | 483 | ||
488 | if(block) | 484 | if(block) |
489 | return ret; | 485 | return ret; |