From f811016cdcf7ca62ae80e086d7b76d82ed0fdf01 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 9 Dec 2009 20:35:56 +0100 Subject: [PATCH] --- yaml --- r: 174303 b: refs/heads/master c: 2de1875a5894794b42fce3833cddf4eac55831de h: refs/heads/master i: 174301: ef8d6124ead2bd332c0ec458e7c04b511a30c3b3 174299: b764613da0f482f9cd5b7b6f41ed611bfcaeee07 174295: 19201deda385781816f8412834e71648b14eb906 174287: 091e1b51d168537ff3a7f234e248771d078ae31a 174271: ec5ddc957081f270a57f1dfef6dfcfd82549acad v: v3 --- [refs] | 2 +- trunk/drivers/hwmon/w83792d.c | 61 +++++++++++------------------------ 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/[refs] b/[refs] index 6bc299735257..016ef0090d7a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3f8b845940c8344e88123bead66b5a871e6366df +refs/heads/master: 2de1875a5894794b42fce3833cddf4eac55831de diff --git a/trunk/drivers/hwmon/w83792d.c b/trunk/drivers/hwmon/w83792d.c index 2be16194ddf3..38978851333f 100644 --- a/trunk/drivers/hwmon/w83792d.c +++ b/trunk/drivers/hwmon/w83792d.c @@ -1273,58 +1273,33 @@ w83792d_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) return -ENODEV; } - /* The w83792d may be stuck in some other bank than bank 0. This may - make reading other information impossible. Specify a force=... or - force_*=... parameter, and the Winbond will be reset to the right - bank. */ - if (kind < 0) { - if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) { - return -ENODEV; - } - val1 = w83792d_read_value(client, W83792D_REG_BANK); - val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); - /* Check for Winbond ID if in bank 0 */ - if (!(val1 & 0x07)) { /* is Bank0 */ - if (((!(val1 & 0x80)) && (val2 != 0xa3)) || - ((val1 & 0x80) && (val2 != 0x5c))) { - return -ENODEV; - } - } - /* If Winbond chip, address of chip and W83792D_REG_I2C_ADDR - should match */ - if (w83792d_read_value(client, - W83792D_REG_I2C_ADDR) != address) { + if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) + return -ENODEV; + + val1 = w83792d_read_value(client, W83792D_REG_BANK); + val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); + /* Check for Winbond ID if in bank 0 */ + if (!(val1 & 0x07)) { /* is Bank0 */ + if ((!(val1 & 0x80) && val2 != 0xa3) || + ( (val1 & 0x80) && val2 != 0x5c)) return -ENODEV; - } } + /* If Winbond chip, address of chip and W83792D_REG_I2C_ADDR + should match */ + if (w83792d_read_value(client, W83792D_REG_I2C_ADDR) != address) + return -ENODEV; - /* We have either had a force parameter, or we have already detected the - Winbond. Put it now into bank 0 and Vendor ID High Byte */ + /* Put it now into bank 0 and Vendor ID High Byte */ w83792d_write_value(client, W83792D_REG_BANK, (w83792d_read_value(client, W83792D_REG_BANK) & 0x78) | 0x80); /* Determine the chip type. */ - if (kind <= 0) { - /* get vendor ID */ - val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); - if (val2 != 0x5c) { /* the vendor is NOT Winbond */ - return -ENODEV; - } - val1 = w83792d_read_value(client, W83792D_REG_WCHIPID); - if (val1 == 0x7a) { - kind = w83792d; - } else { - if (kind == 0) - dev_warn(&adapter->dev, - "w83792d: Ignoring 'force' parameter for" - " unknown chip at adapter %d, address" - " 0x%02x\n", i2c_adapter_id(adapter), - address); - return -ENODEV; - } - } + val1 = w83792d_read_value(client, W83792D_REG_WCHIPID); + val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); + if (val1 != 0x7a || val2 != 0x5c) + return -ENODEV; strlcpy(info->type, "w83792d", I2C_NAME_SIZE);