Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220511
b: refs/heads/master
c: 4275fcd
h: refs/heads/master
i:
  220509: ef955bc
  220507: 313b80c
  220503: 19081bd
  220495: 1ac081f
  220479: 6fe1164
v: v3
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Oct 28, 2010
1 parent 426d98b commit 1428856
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24377101023d3c66136123bd8b20441814da6a90
refs/heads/master: 4275fcd65d3b4a504b7779e532c81a927afd28c0
12 changes: 12 additions & 0 deletions trunk/drivers/hwmon/pcf8591.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/hwmon.h>

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
Expand Down Expand Up @@ -71,6 +73,7 @@ MODULE_PARM_DESC(input_mode,
#define REG_TO_SIGNED(reg) (((reg) & 0x80)?((reg) - 256):(reg))

struct pcf8591_data {
struct device *hwmon_dev;
struct mutex update_lock;

u8 control;
Expand Down Expand Up @@ -221,6 +224,12 @@ static int pcf8591_probe(struct i2c_client *client,
goto exit_sysfs_remove;
}

data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_sysfs_remove;
}

return 0;

exit_sysfs_remove:
Expand All @@ -234,6 +243,9 @@ static int pcf8591_probe(struct i2c_client *client,

static int pcf8591_remove(struct i2c_client *client)
{
struct pcf8591_data *data = i2c_get_clientdata(client);

hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt);
sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group);
kfree(i2c_get_clientdata(client));
Expand Down

0 comments on commit 1428856

Please sign in to comment.