]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/hwmon/lm80.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
[linux-2.6-omap-h63xx.git] / drivers / hwmon / lm80.c
index dbf8df3862503e9093e3c5e69863279851aca333..c9a7cdea7bd722a6412595f098e9687c3f656cbd 100644 (file)
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c,
                                        0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
-SENSORS_INSMOD_1(lm80);
+I2C_CLIENT_INSMOD_1(lm80);
 
 /* Many LM80 constants specified below */
 
@@ -145,10 +143,10 @@ static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value);
  */
 
 static struct i2c_driver lm80_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "lm80",
+       .driver = {
+               .name   = "lm80",
+       },
        .id             = I2C_DRIVERID_LM80,
-       .flags          = I2C_DF_NOTIFY,
        .attach_adapter = lm80_attach_adapter,
        .detach_client  = lm80_detach_client,
 };
@@ -392,10 +390,10 @@ static int lm80_attach_adapter(struct i2c_adapter *adapter)
 {
        if (!(adapter->class & I2C_CLASS_HWMON))
                return 0;
-       return i2c_detect(adapter, &addr_data, lm80_detect);
+       return i2c_probe(adapter, &addr_data, lm80_detect);
 }
 
-int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
+static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
 {
        int i, cur;
        struct i2c_client *new_client;
@@ -409,11 +407,10 @@ int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
        /* OK. For now, we presume we have a valid client. We now create the
           client structure, even though we cannot fill it completely yet.
           But it allows us to access lm80_{read,write}_value. */
-       if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) {
+       if (!(data = kzalloc(sizeof(struct lm80_data), GFP_KERNEL))) {
                err = -ENOMEM;
                goto exit;
        }
-       memset(data, 0, sizeof(struct lm80_data));
 
        new_client = &data->client;
        i2c_set_clientdata(new_client, data);
@@ -511,11 +508,8 @@ static int lm80_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;