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/f75375s.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/f75375s.c')
-rw-r--r-- | drivers/hwmon/f75375s.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index e2107e533ede..40dfbcd3f3f2 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -681,30 +681,20 @@ static int f75375_detect(struct i2c_client *client, int kind, | |||
681 | struct i2c_board_info *info) | 681 | struct i2c_board_info *info) |
682 | { | 682 | { |
683 | struct i2c_adapter *adapter = client->adapter; | 683 | struct i2c_adapter *adapter = client->adapter; |
684 | u8 version = 0; | 684 | u16 vendid, chipid; |
685 | const char *name = ""; | 685 | u8 version; |
686 | 686 | const char *name; | |
687 | if (kind < 0) { | ||
688 | u16 vendid = f75375_read16(client, F75375_REG_VENDOR); | ||
689 | u16 chipid = f75375_read16(client, F75375_CHIP_ID); | ||
690 | version = f75375_read8(client, F75375_REG_VERSION); | ||
691 | if (chipid == 0x0306 && vendid == 0x1934) { | ||
692 | kind = f75375; | ||
693 | } else if (chipid == 0x0204 && vendid == 0x1934) { | ||
694 | kind = f75373; | ||
695 | } else { | ||
696 | dev_err(&adapter->dev, | ||
697 | "failed,%02X,%02X,%02X\n", | ||
698 | chipid, version, vendid); | ||
699 | return -ENODEV; | ||
700 | } | ||
701 | } | ||
702 | 687 | ||
703 | if (kind == f75375) { | 688 | vendid = f75375_read16(client, F75375_REG_VENDOR); |
689 | chipid = f75375_read16(client, F75375_CHIP_ID); | ||
690 | if (chipid == 0x0306 && vendid == 0x1934) | ||
704 | name = "f75375"; | 691 | name = "f75375"; |
705 | } else if (kind == f75373) { | 692 | else if (chipid == 0x0204 && vendid == 0x1934) |
706 | name = "f75373"; | 693 | name = "f75373"; |
707 | } | 694 | else |
695 | return -ENODEV; | ||
696 | |||
697 | version = f75375_read8(client, F75375_REG_VERSION); | ||
708 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); | 698 | dev_info(&adapter->dev, "found %s version: %02X\n", name, version); |
709 | strlcpy(info->type, name, I2C_NAME_SIZE); | 699 | strlcpy(info->type, name, I2C_NAME_SIZE); |
710 | 700 | ||