X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fhwmon%2Fthmc50.c;h=04dd7699b3ac7c1735ecb82d58c45f941637c3b1;hb=ef3f2de2b5496f721b12f21a157e19eac816394b;hp=981d1f1dc61f20420fbcbe8d720a3c9c8337c365;hpb=1beeffe43311f64df8dd0ab08ff6b1858c58363f;p=powerpc.git diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c index 981d1f1dc6..04dd7699b3 100644 --- a/drivers/hwmon/thmc50.c +++ b/drivers/hwmon/thmc50.c @@ -47,10 +47,10 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs " #define THMC50_REG_DIE_CODE 0x3F #define THMC50_REG_ANALOG_OUT 0x19 /* - * We use mirror status register for reading alarms - * so ACPI can use the primary status register. + * The mirror status register cannot be used as + * reading it does not clear alarms. */ -#define THMC50_REG_INTR_MIRROR 0x4C +#define THMC50_REG_INTR 0x41 const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; @@ -237,7 +237,7 @@ static const struct attribute_group thmc50_group = { }; /* for ADM1022 3rd temperature mode */ -static struct attribute *adm1022_attributes[] = { +static struct attribute *temp3_attributes[] = { &sensor_dev_attr_temp3_max.dev_attr.attr, &sensor_dev_attr_temp3_min.dev_attr.attr, &sensor_dev_attr_temp3_input.dev_attr.attr, @@ -246,8 +246,8 @@ static struct attribute *adm1022_attributes[] = { NULL }; -static const struct attribute_group adm1022_group = { - .attrs = adm1022_attributes, +static const struct attribute_group temp3_group = { + .attrs = temp3_attributes, }; static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) @@ -259,7 +259,7 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) struct thmc50_data *data; struct device *dev; int err = 0; - const char *type_name = ""; + const char *type_name; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { pr_debug("thmc50: detect failed, " @@ -309,13 +309,9 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) pr_debug("thmc50: Detection of THMC50/ADM1022 failed\n"); goto exit_free; } - pr_debug("thmc50: Detected %s (version %x, revision %x)\n", - type_name, (revision >> 4) - 0xc, revision & 0xf); data->type = kind; - if (kind == thmc50) - type_name = "thmc50"; - else if (kind == adm1022) { + if (kind == adm1022) { int id = i2c_adapter_id(client->adapter); int i; @@ -328,7 +324,11 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) data->has_temp3 = 1; break; } + } else { + type_name = "thmc50"; } + pr_debug("thmc50: Detected %s (version %x, revision %x)\n", + type_name, (revision >> 4) - 0xc, revision & 0xf); /* Fill in the remaining client fields & put it into the global list */ strlcpy(client->name, type_name, I2C_NAME_SIZE); @@ -345,9 +345,9 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) goto exit_detach; /* Register ADM1022 sysfs hooks */ - if (data->type == adm1022) + if (data->has_temp3) if ((err = sysfs_create_group(&client->dev.kobj, - &adm1022_group))) + &temp3_group))) goto exit_remove_sysfs_thmc50; /* Register a new directory entry with module sensors */ @@ -360,8 +360,8 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) return 0; exit_remove_sysfs: - if (data->type == adm1022) - sysfs_remove_group(&client->dev.kobj, &adm1022_group); + if (data->has_temp3) + sysfs_remove_group(&client->dev.kobj, &temp3_group); exit_remove_sysfs_thmc50: sysfs_remove_group(&client->dev.kobj, &thmc50_group); exit_detach: @@ -386,8 +386,8 @@ static int thmc50_detach_client(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &thmc50_group); - if (data->type == adm1022) - sysfs_remove_group(&client->dev.kobj, &adm1022_group); + if (data->has_temp3) + sysfs_remove_group(&client->dev.kobj, &temp3_group); if ((err = i2c_detach_client(client))) return err; @@ -441,7 +441,7 @@ static struct thmc50_data *thmc50_update_device(struct device *dev) data->analog_out = i2c_smbus_read_byte_data(client, THMC50_REG_ANALOG_OUT); data->alarms = - i2c_smbus_read_byte_data(client, THMC50_REG_INTR_MIRROR); + i2c_smbus_read_byte_data(client, THMC50_REG_INTR); data->last_updated = jiffies; data->valid = 1; }