Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294832
b: refs/heads/master
c: f7001bb
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck authored and Jean Delvare committed Mar 23, 2012
1 parent d94b7b5 commit ffebb4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 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: ae544f64cc7b0850471f62e6808068ef77b90763
refs/heads/master: f7001bb063ec06e7fff8782146a7bed49dfe6507
21 changes: 13 additions & 8 deletions trunk/drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,15 @@ static void lm90_remove_files(struct i2c_client *client, struct lm90_data *data)
sysfs_remove_group(&dev->kobj, &lm90_group);
}

static void lm90_restore_conf(struct i2c_client *client, struct lm90_data *data)
{
/* Restore initial configuration */
i2c_smbus_write_byte_data(client, LM90_REG_W_CONVRATE,
data->convrate_orig);
i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
data->config_orig);
}

static void lm90_init_client(struct i2c_client *client)
{
u8 config, convrate;
Expand Down Expand Up @@ -1424,7 +1433,7 @@ static int lm90_probe(struct i2c_client *client,
/* Register sysfs hooks */
err = sysfs_create_group(&dev->kobj, &lm90_group);
if (err)
goto exit_free;
goto exit_restore;
if (client->flags & I2C_CLIENT_PEC) {
err = device_create_file(dev, &dev_attr_pec);
if (err)
Expand Down Expand Up @@ -1463,7 +1472,8 @@ static int lm90_probe(struct i2c_client *client,

exit_remove_files:
lm90_remove_files(client, data);
exit_free:
exit_restore:
lm90_restore_conf(client, data);
kfree(data);
exit:
return err;
Expand All @@ -1475,12 +1485,7 @@ static int lm90_remove(struct i2c_client *client)

hwmon_device_unregister(data->hwmon_dev);
lm90_remove_files(client, data);

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

kfree(data);
return 0;
Expand Down

0 comments on commit ffebb4b

Please sign in to comment.