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/adm1026.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/adm1026.c')
-rw-r--r-- | drivers/hwmon/adm1026.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index ff7de40b6e35..fb5363985e21 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -1672,35 +1672,26 @@ static int adm1026_detect(struct i2c_client *client, int kind, | |||
1672 | i2c_adapter_id(client->adapter), client->addr, | 1672 | i2c_adapter_id(client->adapter), client->addr, |
1673 | company, verstep); | 1673 | company, verstep); |
1674 | 1674 | ||
1675 | /* If auto-detecting, Determine the chip type. */ | 1675 | /* Determine the chip type. */ |
1676 | if (kind <= 0) { | 1676 | dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x...\n", |
1677 | dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x " | 1677 | i2c_adapter_id(adapter), address); |
1678 | "...\n", i2c_adapter_id(adapter), address); | 1678 | if (company == ADM1026_COMPANY_ANALOG_DEV |
1679 | if (company == ADM1026_COMPANY_ANALOG_DEV | 1679 | && verstep == ADM1026_VERSTEP_ADM1026) { |
1680 | && verstep == ADM1026_VERSTEP_ADM1026) { | 1680 | /* Analog Devices ADM1026 */ |
1681 | kind = adm1026; | 1681 | } else if (company == ADM1026_COMPANY_ANALOG_DEV |
1682 | } else if (company == ADM1026_COMPANY_ANALOG_DEV | 1682 | && (verstep & 0xf0) == ADM1026_VERSTEP_GENERIC) { |
1683 | && (verstep & 0xf0) == ADM1026_VERSTEP_GENERIC) { | 1683 | dev_err(&adapter->dev, "Unrecognized stepping " |
1684 | dev_err(&adapter->dev, "Unrecognized stepping " | 1684 | "0x%02x. Defaulting to ADM1026.\n", verstep); |
1685 | "0x%02x. Defaulting to ADM1026.\n", verstep); | 1685 | } else if ((verstep & 0xf0) == ADM1026_VERSTEP_GENERIC) { |
1686 | kind = adm1026; | 1686 | dev_err(&adapter->dev, "Found version/stepping " |
1687 | } else if ((verstep & 0xf0) == ADM1026_VERSTEP_GENERIC) { | 1687 | "0x%02x. Assuming generic ADM1026.\n", |
1688 | dev_err(&adapter->dev, "Found version/stepping " | 1688 | verstep); |
1689 | "0x%02x. Assuming generic ADM1026.\n", | 1689 | } else { |
1690 | verstep); | 1690 | dev_dbg(&adapter->dev, "Autodetection failed\n"); |
1691 | kind = any_chip; | 1691 | /* Not an ADM1026... */ |
1692 | } else { | 1692 | return -ENODEV; |
1693 | dev_dbg(&adapter->dev, "Autodetection failed\n"); | ||
1694 | /* Not an ADM1026 ... */ | ||
1695 | if (kind == 0) { /* User used force=x,y */ | ||
1696 | dev_err(&adapter->dev, "Generic ADM1026 not " | ||
1697 | "found at %d,0x%02x. Try " | ||
1698 | "force_adm1026.\n", | ||
1699 | i2c_adapter_id(adapter), address); | ||
1700 | } | ||
1701 | return -ENODEV; | ||
1702 | } | ||
1703 | } | 1693 | } |
1694 | |||
1704 | strlcpy(info->type, "adm1026", I2C_NAME_SIZE); | 1695 | strlcpy(info->type, "adm1026", I2C_NAME_SIZE); |
1705 | 1696 | ||
1706 | return 0; | 1697 | return 0; |