]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/hwmon/asb100.c
Merge branch 'block-dir' of git://brick.kernel.dk/data/git/linux-2.6-block
[linux-2.6-omap-h63xx.git] / drivers / hwmon / asb100.c
index d1856acf87a0920f052b6e0d80f96b37bd3d7ebb..52c469722a6584ea622618dbd99c6c53ff43b329 100644 (file)
@@ -39,9 +39,8 @@
 #include <linux/module.h>
 #include <linux/slab.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>
 #include <linux/init.h>
 #include <linux/jiffies.h>
@@ -57,7 +56,7 @@
 static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
 
 /* Insmod parameters */
-SENSORS_INSMOD_1(asb100);
+I2C_CLIENT_INSMOD_1(asb100);
 I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
        "{bus, clientaddr, subclientaddr1, subclientaddr2}");
 
@@ -621,7 +620,7 @@ static int asb100_attach_adapter(struct i2c_adapter *adapter)
 {
        if (!(adapter->class & I2C_CLASS_HWMON))
                return 0;
-       return i2c_detect(adapter, &addr_data, asb100_detect);
+       return i2c_probe(adapter, &addr_data, asb100_detect);
 }
 
 static int asb100_detect_subclients(struct i2c_adapter *adapter, int address,
@@ -630,19 +629,17 @@ static int asb100_detect_subclients(struct i2c_adapter *adapter, int address,
        int i, id, err;
        struct asb100_data *data = i2c_get_clientdata(new_client);
 
-       data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (!(data->lm75[0])) {
                err = -ENOMEM;
                goto ERROR_SC_0;
        }
-       memset(data->lm75[0], 0x00, sizeof(struct i2c_client));
 
-       data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       data->lm75[1] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (!(data->lm75[1])) {
                err = -ENOMEM;
                goto ERROR_SC_1;
        }
-       memset(data->lm75[1], 0x00, sizeof(struct i2c_client));
 
        id = i2c_adapter_id(adapter);
 
@@ -714,14 +711,6 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
        struct i2c_client *new_client;
        struct asb100_data *data;
 
-       /* asb100 is SMBus only */
-       if (i2c_is_isa_adapter(adapter)) {
-               pr_debug("asb100.o: detect failed, "
-                               "cannot attach to legacy adapter!\n");
-               err = -ENODEV;
-               goto ERROR0;
-       }
-
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
                pr_debug("asb100.o: detect failed, "
                                "smbus byte data not supported!\n");
@@ -733,12 +722,11 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
           client structure, even though we cannot fill it completely yet.
           But it allows us to access asb100_{read,write}_value. */
 
-       if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) {
-               pr_debug("asb100.o: detect failed, kmalloc failed!\n");
+       if (!(data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL))) {
+               pr_debug("asb100.o: detect failed, kzalloc failed!\n");
                err = -ENOMEM;
                goto ERROR0;
        }
-       memset(data, 0, sizeof(struct asb100_data));
 
        new_client = &data->client;
        init_MUTEX(&data->lock);
@@ -875,11 +863,8 @@ static int asb100_detach_client(struct i2c_client *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");
+       if ((err = i2c_detach_client(client)))
                return err;
-       }
 
        /* main client */
        if (data)
@@ -985,7 +970,7 @@ static void asb100_init_client(struct i2c_client *client)
 
        vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f;
        vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4;
-       data->vrm = i2c_which_vrm();
+       data->vrm = vid_which_vrm();
        vid = vid_from_reg(vid, data->vrm);
 
        /* Start monitoring */