Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186418
b: refs/heads/master
c: dc71afe
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare committed Mar 5, 2010
1 parent 6fb6bb0 commit d16e912
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a44908d742a577fb5ccb9a8c082326d4cea234c2
refs/heads/master: dc71afe5ac7e8d049bb991330518e4c898a7d92e
15 changes: 6 additions & 9 deletions trunk/drivers/hwmon/fschmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ struct fschmd_data {
struct list_head list; /* member of the watchdog_data_list */
struct kref kref;
struct miscdevice watchdog_miscdev;
int kind;
enum chips kind;
unsigned long watchdog_is_open;
char watchdog_expect_close;
char watchdog_name[10]; /* must be unique to avoid sysfs conflict */
Expand Down Expand Up @@ -325,8 +325,7 @@ static ssize_t show_in_value(struct device *dev,
int index = to_sensor_dev_attr(devattr)->index;
struct fschmd_data *data = fschmd_update_device(dev);

/* fscher / fschrc - 1 as data->kind is an array index, not a chips */
if (data->kind == (fscher - 1) || data->kind >= (fschrc - 1))
if (data->kind == fscher || data->kind >= fschrc)
return sprintf(buf, "%d\n", (data->volt[index] * dmi_vref *
dmi_mult[index]) / 255 + dmi_offset[index]);
else
Expand Down Expand Up @@ -492,7 +491,7 @@ static ssize_t show_pwm_auto_point1_pwm(struct device *dev,
int val = data->fan_min[index];

/* 0 = allow turning off (except on the syl), 1-255 = 50-100% */
if (val || data->kind == fscsyl - 1)
if (val || data->kind == fscsyl)
val = val / 2 + 128;

return sprintf(buf, "%d\n", val);
Expand All @@ -506,7 +505,7 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev,
unsigned long v = simple_strtoul(buf, NULL, 10);

/* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */
if (v || data->kind == fscsyl - 1) {
if (v || data->kind == fscsyl) {
v = SENSORS_LIMIT(v, 128, 255);
v = (v - 128) * 2 + 1;
}
Expand Down Expand Up @@ -1037,7 +1036,7 @@ static int fschmd_detect(struct i2c_client *client,
else
return -ENODEV;

strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE);
strlcpy(info->type, fschmd_id[kind].name, I2C_NAME_SIZE);

return 0;
}
Expand Down Expand Up @@ -1065,6 +1064,7 @@ static int fschmd_probe(struct i2c_client *client,
(where the client is found through a data ptr instead of the
otherway around) */
data->client = client;
data->kind = kind;

if (kind == fscpos) {
/* The Poseidon has hardwired temp limits, fill these
Expand All @@ -1085,9 +1085,6 @@ static int fschmd_probe(struct i2c_client *client,
}
}

/* i2c kind goes from 1-6, we want from 0-5 to address arrays */
data->kind = kind - 1;

/* Read in some never changing registers */
data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION);
data->global_control = i2c_smbus_read_byte_data(client,
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/hwmon/tmp401.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct tmp401_data {
struct mutex update_lock;
char valid; /* zero until following fields are valid */
unsigned long last_updated; /* in jiffies */
int kind;
enum chips kind;

/* register values */
u8 status;
Expand Down Expand Up @@ -524,7 +524,7 @@ static int tmp401_detect(struct i2c_client *client,
if (reg > 15)
return -ENODEV;

strlcpy(info->type, tmp401_id[kind - 1].name, I2C_NAME_SIZE);
strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE);

return 0;
}
Expand Down Expand Up @@ -572,8 +572,7 @@ static int tmp401_probe(struct i2c_client *client,
goto exit_remove;
}

dev_info(&client->dev, "Detected TI %s chip\n",
names[data->kind - 1]);
dev_info(&client->dev, "Detected TI %s chip\n", names[data->kind]);

return 0;

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/hwmon/tmp421.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ static int tmp421_detect(struct i2c_client *client,
return -ENODEV;
}

strlcpy(info->type, tmp421_id[kind - 1].name, I2C_NAME_SIZE);
strlcpy(info->type, tmp421_id[kind].name, I2C_NAME_SIZE);
dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n",
names[kind - 1], client->addr);
names[kind], client->addr);

return 0;
}
Expand Down

0 comments on commit d16e912

Please sign in to comment.