Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186398
b: refs/heads/master
c: 9523836
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare committed Mar 5, 2010
1 parent c852e24 commit 4e83668
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 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: 6771ea1fff988651593f78c122bc02e80f5100a0
refs/heads/master: 95238364167edaf93ce2890e5f55326b63194851
14 changes: 10 additions & 4 deletions trunk/drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* lm90.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
* Copyright (C) 2003-2009 Jean Delvare <khali@linux-fr.org>
* Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org>
*
* Based on the lm83 driver. The LM90 is a sensor chip made by National
* Semiconductor. It reports up to two temperatures (its own plus up to
Expand Down Expand Up @@ -203,6 +203,8 @@ struct lm90_data {
int kind;
int flags;

u8 config_orig; /* Original configuration register value */

/* registers values */
s8 temp8[4]; /* 0: local low limit
1: local high limit
Expand Down Expand Up @@ -840,7 +842,7 @@ static int lm90_probe(struct i2c_client *new_client,

static void lm90_init_client(struct i2c_client *client)
{
u8 config, config_orig;
u8 config;
struct lm90_data *data = i2c_get_clientdata(client);

/*
Expand All @@ -852,7 +854,7 @@ static void lm90_init_client(struct i2c_client *client)
dev_warn(&client->dev, "Initialization failed!\n");
return;
}
config_orig = config;
data->config_orig = config;

/* Check Temperature Range Select */
if (data->kind == adt7461) {
Expand All @@ -870,7 +872,7 @@ static void lm90_init_client(struct i2c_client *client)
}

config &= 0xBF; /* run */
if (config != config_orig) /* Only write if changed */
if (config != data->config_orig) /* Only write if changed */
i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config);
}

Expand All @@ -885,6 +887,10 @@ static int lm90_remove(struct i2c_client *client)
device_remove_file(&client->dev,
&sensor_dev_attr_temp2_offset.dev_attr);

/* Restore initial configuration */
i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
data->config_orig);

kfree(data);
return 0;
}
Expand Down

0 comments on commit 4e83668

Please sign in to comment.