hwmon: Clean up detect functions
[linux-2.6-microblaze.git] / drivers / hwmon / gl518sm.c
index 7820df4..1d69458 100644 (file)
@@ -488,36 +488,21 @@ static int gl518_detect(struct i2c_client *client, int kind,
                        struct i2c_board_info *info)
 {
        struct i2c_adapter *adapter = client->adapter;
-       int i;
+       int rev;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
                                     I2C_FUNC_SMBUS_WORD_DATA))
                return -ENODEV;
 
        /* Now, we do the remaining detection. */
-
-       if (kind < 0) {
-               if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80)
-                || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
-                       return -ENODEV;
-       }
+       if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80)
+        || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
+               return -ENODEV;
 
        /* Determine the chip type. */
-       if (kind <= 0) {
-               i = gl518_read_value(client, GL518_REG_REVISION);
-               if (i == 0x00) {
-                       kind = gl518sm_r00;
-               } else if (i == 0x80) {
-                       kind = gl518sm_r80;
-               } else {
-                       if (kind <= 0)
-                               dev_info(&adapter->dev,
-                                   "Ignoring 'force' parameter for unknown "
-                                   "chip at adapter %d, address 0x%02x\n",
-                                   i2c_adapter_id(adapter), client->addr);
-                       return -ENODEV;
-               }
-       }
+       rev = gl518_read_value(client, GL518_REG_REVISION);
+       if (rev != 0x00 && rev != 0x80)
+               return -ENODEV;
 
        strlcpy(info->type, "gl518sm", I2C_NAME_SIZE);