]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/lm87.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[linux-2.6] / drivers / hwmon / lm87.c
index 1dc3bf52b40d9d6c25f08f1d0db19182a201537d..6ba34c302d8d3315f53f038af876f152d16ad055 100644 (file)
@@ -57,9 +57,8 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
-#include <linux/i2c-sensor.h>
-#include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
+#include <linux/hwmon-vid.h>
 #include <linux/err.h>
 
 /*
@@ -73,7 +72,7 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
  * Insmod parameters
  */
 
-SENSORS_INSMOD_1(lm87);
+I2C_CLIENT_INSMOD_1(lm87);
 
 /*
  * The LM87 registers
@@ -162,10 +161,10 @@ static struct lm87_data *lm87_update_device(struct device *dev);
  */
 
 static struct i2c_driver lm87_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "lm87",
+       .driver = {
+               .name   = "lm87",
+       },
        .id             = I2C_DRIVERID_LM87,
-       .flags          = I2C_DF_NOTIFY,
        .attach_adapter = lm87_attach_adapter,
        .detach_client  = lm87_detach_client,
 };
@@ -539,7 +538,7 @@ static int lm87_attach_adapter(struct i2c_adapter *adapter)
 {
        if (!(adapter->class & I2C_CLASS_HWMON))
                return 0;
-       return i2c_detect(adapter, &addr_data, lm87_detect);
+       return i2c_probe(adapter, &addr_data, lm87_detect);
 }
 
 /*
@@ -555,11 +554,10 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                goto exit;
 
-       if (!(data = kmalloc(sizeof(struct lm87_data), GFP_KERNEL))) {
+       if (!(data = kzalloc(sizeof(struct lm87_data), GFP_KERNEL))) {
                err = -ENOMEM;
                goto exit;
        }
-       memset(data, 0, sizeof(struct lm87_data));
 
        /* The common I2C client data is placed right before the
           LM87-specific data. */
@@ -695,7 +693,7 @@ static void lm87_init_client(struct i2c_client *client)
        u8 config;
 
        data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
-       data->vrm = i2c_which_vrm();
+       data->vrm = vid_which_vrm();
 
        config = lm87_read_value(client, LM87_REG_CONFIG);
        if (!(config & 0x01)) {
@@ -734,11 +732,8 @@ static int lm87_detach_client(struct i2c_client *client)
 
        hwmon_device_unregister(data->class_dev);
 
-       if ((err = i2c_detach_client(client))) {
-               dev_err(&client->dev, "Client deregistration failed, "
-                       "client not detached.\n");
+       if ((err = i2c_detach_client(client)))
                return err;
-       }
 
        kfree(data);
        return 0;