diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 14:35:57 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 14:35:57 -0500 |
commit | 52df6440a29123eed912183fe785bbe174ef14b9 (patch) | |
tree | 3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/adt7462.c | |
parent | a1fa4cdcc4abd4c02a81ab7052c16a342d29f060 (diff) |
hwmon: Clean up detect functions
As kind is now hard-coded to -1, there is room for code clean-ups.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Acked-by: "Hans J. Koch" <hjk@linutronix.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Diffstat (limited to 'drivers/hwmon/adt7462.c')
-rw-r--r-- | drivers/hwmon/adt7462.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c index 1852f27bac51..f9c9562b6a94 100644 --- a/drivers/hwmon/adt7462.c +++ b/drivers/hwmon/adt7462.c | |||
@@ -1906,27 +1906,22 @@ static int adt7462_detect(struct i2c_client *client, int kind, | |||
1906 | struct i2c_board_info *info) | 1906 | struct i2c_board_info *info) |
1907 | { | 1907 | { |
1908 | struct i2c_adapter *adapter = client->adapter; | 1908 | struct i2c_adapter *adapter = client->adapter; |
1909 | int vendor, device, revision; | ||
1909 | 1910 | ||
1910 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1911 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1911 | return -ENODEV; | 1912 | return -ENODEV; |
1912 | 1913 | ||
1913 | if (kind <= 0) { | 1914 | vendor = i2c_smbus_read_byte_data(client, ADT7462_REG_VENDOR); |
1914 | int vendor, device, revision; | 1915 | if (vendor != ADT7462_VENDOR) |
1915 | 1916 | return -ENODEV; | |
1916 | vendor = i2c_smbus_read_byte_data(client, ADT7462_REG_VENDOR); | ||
1917 | if (vendor != ADT7462_VENDOR) | ||
1918 | return -ENODEV; | ||
1919 | 1917 | ||
1920 | device = i2c_smbus_read_byte_data(client, ADT7462_REG_DEVICE); | 1918 | device = i2c_smbus_read_byte_data(client, ADT7462_REG_DEVICE); |
1921 | if (device != ADT7462_DEVICE) | 1919 | if (device != ADT7462_DEVICE) |
1922 | return -ENODEV; | 1920 | return -ENODEV; |
1923 | 1921 | ||
1924 | revision = i2c_smbus_read_byte_data(client, | 1922 | revision = i2c_smbus_read_byte_data(client, ADT7462_REG_REVISION); |
1925 | ADT7462_REG_REVISION); | 1923 | if (revision != ADT7462_REVISION) |
1926 | if (revision != ADT7462_REVISION) | 1924 | return -ENODEV; |
1927 | return -ENODEV; | ||
1928 | } else | ||
1929 | dev_dbg(&adapter->dev, "detection forced\n"); | ||
1930 | 1925 | ||
1931 | strlcpy(info->type, "adt7462", I2C_NAME_SIZE); | 1926 | strlcpy(info->type, "adt7462", I2C_NAME_SIZE); |
1932 | 1927 | ||