Loading drivers/hwmon/lm85.c +65 −92 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ Copyright (c) 2002, 2003 Philip Pokorny <ppokorny@penguincomputing.com> Copyright (c) 2003 Margit Schubert-While <margitsw@t-online.de> Copyright (c) 2004 Justin Thiessen <jthiessen@penguincomputing.com> Copyright (C) 2007, 2008 Jean Delvare <khali@linux-fr.org> Copyright (C) 2007--2009 Jean Delvare <khali@linux-fr.org> Chip details at <http://www.national.com/ds/LM/LM85.pdf> Loading Loading @@ -1162,16 +1162,16 @@ static int lm85_detect(struct i2c_client *client, int kind, struct i2c_adapter *adapter = client->adapter; int address = client->addr; const char *type_name; int company, verstep; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { /* We need to be able to do byte I/O */ return -ENODEV; } /* If auto-detecting, determine the chip type */ if (kind < 0) { int company = lm85_read_value(client, LM85_REG_COMPANY); int verstep = lm85_read_value(client, LM85_REG_VERSTEP); /* Determine the chip type */ company = lm85_read_value(client, LM85_REG_COMPANY); verstep = lm85_read_value(client, LM85_REG_VERSTEP); dev_dbg(&adapter->dev, "Detecting device at 0x%02x with " "COMPANY: 0x%02x and VERSTEP: 0x%02x\n", Loading @@ -1180,28 +1180,27 @@ static int lm85_detect(struct i2c_client *client, int kind, /* All supported chips have the version in common */ if ((verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC && (verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC2) { dev_dbg(&adapter->dev, "Autodetection failed: " "unsupported version\n"); dev_dbg(&adapter->dev, "Autodetection failed: unsupported version\n"); return -ENODEV; } kind = any_chip; type_name = "lm85"; /* Now, refine the detection */ if (company == LM85_COMPANY_NATIONAL) { switch (verstep) { case LM85_VERSTEP_LM85C: kind = lm85c; type_name = "lm85c"; break; case LM85_VERSTEP_LM85B: kind = lm85b; type_name = "lm85b"; break; case LM85_VERSTEP_LM96000_1: case LM85_VERSTEP_LM96000_2: /* Check for Winbond WPCD377I */ if (lm85_is_fake(client)) { dev_dbg(&adapter->dev, "Found Winbond WPCD377I, " "ignoring\n"); "Found Winbond WPCD377I, ignoring\n"); return -ENODEV; } break; Loading @@ -1209,15 +1208,15 @@ static int lm85_detect(struct i2c_client *client, int kind, } else if (company == LM85_COMPANY_ANALOG_DEV) { switch (verstep) { case LM85_VERSTEP_ADM1027: kind = adm1027; type_name = "adm1027"; break; case LM85_VERSTEP_ADT7463: case LM85_VERSTEP_ADT7463C: kind = adt7463; type_name = "adt7463"; break; case LM85_VERSTEP_ADT7468_1: case LM85_VERSTEP_ADT7468_2: kind = adt7468; type_name = "adt7468"; break; } } else if (company == LM85_COMPANY_SMSC) { Loading @@ -1225,44 +1224,18 @@ static int lm85_detect(struct i2c_client *client, int kind, case LM85_VERSTEP_EMC6D100_A0: case LM85_VERSTEP_EMC6D100_A1: /* Note: we can't tell a '100 from a '101 */ kind = emc6d100; type_name = "emc6d100"; break; case LM85_VERSTEP_EMC6D102: kind = emc6d102; type_name = "emc6d102"; break; } } else { dev_dbg(&adapter->dev, "Autodetection failed: " "unknown vendor\n"); dev_dbg(&adapter->dev, "Autodetection failed: unknown vendor\n"); return -ENODEV; } } switch (kind) { case lm85b: type_name = "lm85b"; break; case lm85c: type_name = "lm85c"; break; case adm1027: type_name = "adm1027"; break; case adt7463: type_name = "adt7463"; break; case adt7468: type_name = "adt7468"; break; case emc6d100: type_name = "emc6d100"; break; case emc6d102: type_name = "emc6d102"; break; default: type_name = "lm85"; } strlcpy(info->type, type_name, I2C_NAME_SIZE); return 0; Loading Loading
drivers/hwmon/lm85.c +65 −92 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ Copyright (c) 2002, 2003 Philip Pokorny <ppokorny@penguincomputing.com> Copyright (c) 2003 Margit Schubert-While <margitsw@t-online.de> Copyright (c) 2004 Justin Thiessen <jthiessen@penguincomputing.com> Copyright (C) 2007, 2008 Jean Delvare <khali@linux-fr.org> Copyright (C) 2007--2009 Jean Delvare <khali@linux-fr.org> Chip details at <http://www.national.com/ds/LM/LM85.pdf> Loading Loading @@ -1162,16 +1162,16 @@ static int lm85_detect(struct i2c_client *client, int kind, struct i2c_adapter *adapter = client->adapter; int address = client->addr; const char *type_name; int company, verstep; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { /* We need to be able to do byte I/O */ return -ENODEV; } /* If auto-detecting, determine the chip type */ if (kind < 0) { int company = lm85_read_value(client, LM85_REG_COMPANY); int verstep = lm85_read_value(client, LM85_REG_VERSTEP); /* Determine the chip type */ company = lm85_read_value(client, LM85_REG_COMPANY); verstep = lm85_read_value(client, LM85_REG_VERSTEP); dev_dbg(&adapter->dev, "Detecting device at 0x%02x with " "COMPANY: 0x%02x and VERSTEP: 0x%02x\n", Loading @@ -1180,28 +1180,27 @@ static int lm85_detect(struct i2c_client *client, int kind, /* All supported chips have the version in common */ if ((verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC && (verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC2) { dev_dbg(&adapter->dev, "Autodetection failed: " "unsupported version\n"); dev_dbg(&adapter->dev, "Autodetection failed: unsupported version\n"); return -ENODEV; } kind = any_chip; type_name = "lm85"; /* Now, refine the detection */ if (company == LM85_COMPANY_NATIONAL) { switch (verstep) { case LM85_VERSTEP_LM85C: kind = lm85c; type_name = "lm85c"; break; case LM85_VERSTEP_LM85B: kind = lm85b; type_name = "lm85b"; break; case LM85_VERSTEP_LM96000_1: case LM85_VERSTEP_LM96000_2: /* Check for Winbond WPCD377I */ if (lm85_is_fake(client)) { dev_dbg(&adapter->dev, "Found Winbond WPCD377I, " "ignoring\n"); "Found Winbond WPCD377I, ignoring\n"); return -ENODEV; } break; Loading @@ -1209,15 +1208,15 @@ static int lm85_detect(struct i2c_client *client, int kind, } else if (company == LM85_COMPANY_ANALOG_DEV) { switch (verstep) { case LM85_VERSTEP_ADM1027: kind = adm1027; type_name = "adm1027"; break; case LM85_VERSTEP_ADT7463: case LM85_VERSTEP_ADT7463C: kind = adt7463; type_name = "adt7463"; break; case LM85_VERSTEP_ADT7468_1: case LM85_VERSTEP_ADT7468_2: kind = adt7468; type_name = "adt7468"; break; } } else if (company == LM85_COMPANY_SMSC) { Loading @@ -1225,44 +1224,18 @@ static int lm85_detect(struct i2c_client *client, int kind, case LM85_VERSTEP_EMC6D100_A0: case LM85_VERSTEP_EMC6D100_A1: /* Note: we can't tell a '100 from a '101 */ kind = emc6d100; type_name = "emc6d100"; break; case LM85_VERSTEP_EMC6D102: kind = emc6d102; type_name = "emc6d102"; break; } } else { dev_dbg(&adapter->dev, "Autodetection failed: " "unknown vendor\n"); dev_dbg(&adapter->dev, "Autodetection failed: unknown vendor\n"); return -ENODEV; } } switch (kind) { case lm85b: type_name = "lm85b"; break; case lm85c: type_name = "lm85c"; break; case adm1027: type_name = "adm1027"; break; case adt7463: type_name = "adt7463"; break; case adt7468: type_name = "adt7468"; break; case emc6d100: type_name = "emc6d100"; break; case emc6d102: type_name = "emc6d102"; break; default: type_name = "lm85"; } strlcpy(info->type, type_name, I2C_NAME_SIZE); return 0; Loading