lis3lv02d: remove calibaration functionality
[safe/jmp/linux-2.6] / drivers / hwmon / fschmd.c
index 2a7a85a..bd0fc67 100644 (file)
@@ -56,7 +56,8 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
        __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-I2C_CLIENT_INSMOD_7(fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl);
+
+enum chips { fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl };
 
 /*
  * The FSCHMD registers and other defines
@@ -221,7 +222,7 @@ static const int FSCHMD_NO_TEMP_SENSORS[7] = { 3, 3, 4, 3, 5, 5, 11 };
 
 static int fschmd_probe(struct i2c_client *client,
                        const struct i2c_device_id *id);
-static int fschmd_detect(struct i2c_client *client, int kind,
+static int fschmd_detect(struct i2c_client *client,
                         struct i2c_board_info *info);
 static int fschmd_remove(struct i2c_client *client);
 static struct fschmd_data *fschmd_update_device(struct device *dev);
@@ -251,7 +252,7 @@ static struct i2c_driver fschmd_driver = {
        .remove         = fschmd_remove,
        .id_table       = fschmd_id,
        .detect         = fschmd_detect,
-       .address_data   = &addr_data,
+       .address_list   = normal_i2c,
 };
 
 /*
@@ -819,7 +820,7 @@ static int watchdog_release(struct inode *inode, struct file *filp)
 static ssize_t watchdog_write(struct file *filp, const char __user *buf,
        size_t count, loff_t *offset)
 {
-       size_t ret;
+       int ret;
        struct fschmd_data *data = filp->private_data;
 
        if (count) {
@@ -1000,43 +1001,38 @@ static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy)
        }
 }
 
-static int fschmd_detect(struct i2c_client *client, int kind,
+static int fschmd_detect(struct i2c_client *client,
                         struct i2c_board_info *info)
 {
+       enum chips kind;
        struct i2c_adapter *adapter = client->adapter;
+       char id[4];
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return -ENODEV;
 
        /* Detect & Identify the chip */
-       if (kind <= 0) {
-               char id[4];
-
-               id[0] = i2c_smbus_read_byte_data(client,
-                               FSCHMD_REG_IDENT_0);
-               id[1] = i2c_smbus_read_byte_data(client,
-                               FSCHMD_REG_IDENT_1);
-               id[2] = i2c_smbus_read_byte_data(client,
-                               FSCHMD_REG_IDENT_2);
-               id[3] = '\0';
-
-               if (!strcmp(id, "PEG"))
-                       kind = fscpos;
-               else if (!strcmp(id, "HER"))
-                       kind = fscher;
-               else if (!strcmp(id, "SCY"))
-                       kind = fscscy;
-               else if (!strcmp(id, "HRC"))
-                       kind = fschrc;
-               else if (!strcmp(id, "HMD"))
-                       kind = fschmd;
-               else if (!strcmp(id, "HDS"))
-                       kind = fschds;
-               else if (!strcmp(id, "SYL"))
-                       kind = fscsyl;
-               else
-                       return -ENODEV;
-       }
+       id[0] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_0);
+       id[1] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_1);
+       id[2] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_2);
+       id[3] = '\0';
+
+       if (!strcmp(id, "PEG"))
+               kind = fscpos;
+       else if (!strcmp(id, "HER"))
+               kind = fscher;
+       else if (!strcmp(id, "SCY"))
+               kind = fscscy;
+       else if (!strcmp(id, "HRC"))
+               kind = fschrc;
+       else if (!strcmp(id, "HMD"))
+               kind = fschmd;
+       else if (!strcmp(id, "HDS"))
+               kind = fschds;
+       else if (!strcmp(id, "SYL"))
+               kind = fscsyl;
+       else
+               return -ENODEV;
 
        strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE);