Hello, This patch adds registration of hwmon class. Tested with help of i2c-stub. Signed-Off-By: Rudolf Marek <r.marek at sh.cvut.cz> Please apply. Regards Rudolf diff -Naur b/drivers/hwmon/w83792d.c c/drivers/hwmon/w83792d.c --- b/drivers/hwmon/w83792d.c 2005-07-27 10:30:03.212372250 +0200 +++ c/drivers/hwmon/w83792d.c 2005-07-27 10:51:21.180240250 +0200 @@ -42,7 +42,9 @@ #include <linux/i2c.h> #include <linux/i2c-sensor.h> #include <linux/i2c-vid.h> +#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> +#include <linux/err.h> /* Addresses to scan */ static unsigned short normal_i2c[] = { 0x2c, 0x2f, I2C_CLIENT_END }; @@ -267,6 +269,7 @@ struct w83792d_data { struct i2c_client client; + struct class_device *class_dev; struct semaphore lock; enum chips type; @@ -1289,6 +1292,11 @@ } /* Register sysfs hooks */ + data->class_dev = hwmon_device_register(&new_client->dev); + if (IS_ERR(data->class_dev)) { + err = PTR_ERR(data->class_dev); + goto ERROR2; + } device_create_file_in(new_client, 0); device_create_file_in(new_client, 1); device_create_file_in(new_client, 2); @@ -1372,21 +1380,25 @@ static int w83792d_detach_client(struct i2c_client *client) { + struct w83792d_data *data = i2c_get_clientdata(client); int err; + /* main client */ + if (data) + hwmon_device_unregister(data->class_dev); + if ((err = i2c_detach_client(client))) { dev_err(&client->dev, "Client deregistration failed, client not detached.\n"); return err; } - if (i2c_get_clientdata(client)==NULL) { - /* subclients */ + /* main client */ + if (data) + kfree(data); + /* subclient */ + else kfree(client); - } else { - /* main client */ - kfree(i2c_get_clientdata(client)); - } return 0; }