Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115511
b: refs/heads/master
c: d2cac80
h: refs/heads/master
i:
  115509: f016e2d
  115507: 989c10a
  115503: 35f86ff
v: v3
  • Loading branch information
Ben Hutchings authored and Jean Delvare committed Oct 17, 2008
1 parent 7575997 commit e374d83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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: 49ae6cc8005f45edadf237089c31885834f2608e
refs/heads/master: d2cac802feae6f0c246a9251eefc482bf5ec0f0f
12 changes: 7 additions & 5 deletions trunk/drivers/hwmon/lm87.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ struct lm87_data {
unsigned long last_updated; /* In jiffies */

u8 channel; /* register value */
u8 config; /* original register value */

u8 in[8]; /* register value */
u8 in_max[8]; /* register value */
Expand Down Expand Up @@ -832,6 +833,7 @@ static int lm87_probe(struct i2c_client *new_client,
sysfs_remove_group(&new_client->dev.kobj, &lm87_group);
sysfs_remove_group(&new_client->dev.kobj, &lm87_group_opt);
exit_free:
lm87_write_value(new_client, LM87_REG_CONFIG, data->config);
kfree(data);
exit:
return err;
Expand All @@ -840,12 +842,11 @@ static int lm87_probe(struct i2c_client *new_client,
static void lm87_init_client(struct i2c_client *client)
{
struct lm87_data *data = i2c_get_clientdata(client);
u8 config;

data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
data->config = lm87_read_value(client, LM87_REG_CONFIG) & 0x6F;

config = lm87_read_value(client, LM87_REG_CONFIG);
if (!(config & 0x01)) {
if (!(data->config & 0x01)) {
int i;

/* Limits are left uninitialized after power-up */
Expand All @@ -869,9 +870,9 @@ static void lm87_init_client(struct i2c_client *client)
}

/* Make sure Start is set and INT#_Clear is clear */
if ((config & 0x09) != 0x01)
if ((data->config & 0x09) != 0x01)
lm87_write_value(client, LM87_REG_CONFIG,
(config & 0x77) | 0x01);
(data->config & 0x77) | 0x01);
}

static int lm87_remove(struct i2c_client *client)
Expand All @@ -882,6 +883,7 @@ static int lm87_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &lm87_group);
sysfs_remove_group(&client->dev.kobj, &lm87_group_opt);

lm87_write_value(client, LM87_REG_CONFIG, data->config);
kfree(data);
return 0;
}
Expand Down

0 comments on commit e374d83

Please sign in to comment.