aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:45 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:45 -0400
commit093d1a4794cc23dd221019eb1cdf42b16b48abcc (patch)
treec306a2d26ed2d90f3c53e26790aca495167a59a3 /drivers/hwmon
parent315bacfdbe5a77309c256b296f30bee13d59462b (diff)
hwmon: (w83795) Drop duplicate enum
Enum chips and chip_types are redundant, get rid of the former. Fix the detection code to properly identify the chip variant and name the client accordingly. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83795.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 7b93ac296d03..d7e1d3693a20 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -38,8 +38,6 @@
38/* Addresses to scan */ 38/* Addresses to scan */
39static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 39static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
40 40
41enum chips { w83795 };
42
43 41
44static int reset; 42static int reset;
45module_param(reset, bool, 0); 43module_param(reset, bool, 0);
@@ -1686,6 +1684,7 @@ static int w83795_detect(struct i2c_client *client,
1686 u8 tmp, bank; 1684 u8 tmp, bank;
1687 struct i2c_adapter *adapter = client->adapter; 1685 struct i2c_adapter *adapter = client->adapter;
1688 unsigned short address = client->addr; 1686 unsigned short address = client->addr;
1687 const char *chip_name;
1689 1688
1690 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1689 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1691 return -ENODEV; 1690 return -ENODEV;
@@ -1718,18 +1717,21 @@ static int w83795_detect(struct i2c_client *client,
1718 return -ENODEV; 1717 return -ENODEV;
1719 } 1718 }
1720 1719
1721#if 0 1720 /* Check 795 chip type: 795G or 795ADG
1722 /* Check 795 chip type: 795G or 795ADG */ 1721 Usually we don't write to chips during detection, but here we don't
1722 quite have the choice; hopefully it's OK, we are about to return
1723 success anyway */
1724 if ((bank & 0x07) != 0)
1725 i2c_smbus_write_byte_data(client, W83795_REG_BANKSEL,
1726 bank & ~0x07);
1723 if (W83795_REG_CONFIG_CONFIG48 & 1727 if (W83795_REG_CONFIG_CONFIG48 &
1724 w83795_read(client, W83795_REG_CONFIG)) { 1728 i2c_smbus_read_byte_data(client, W83795_REG_CONFIG)) {
1725 data->chip_type = w83795adg; 1729 chip_name = "w83795adg";
1726 } else { 1730 } else {
1727 data->chip_type = w83795g; 1731 chip_name = "w83795g";
1728 } 1732 }
1729#endif
1730 1733
1731 /* Fill in the remaining client fields and put into the global list */ 1734 strlcpy(info->type, chip_name, I2C_NAME_SIZE);
1732 strlcpy(info->type, "w83795", I2C_NAME_SIZE);
1733 1735
1734 return 0; 1736 return 0;
1735} 1737}
@@ -1750,20 +1752,13 @@ static int w83795_probe(struct i2c_client *client,
1750 } 1752 }
1751 1753
1752 i2c_set_clientdata(client, data); 1754 i2c_set_clientdata(client, data);
1755 data->chip_type = id->driver_data;
1753 data->bank = i2c_smbus_read_byte_data(client, W83795_REG_BANKSEL); 1756 data->bank = i2c_smbus_read_byte_data(client, W83795_REG_BANKSEL);
1754 mutex_init(&data->update_lock); 1757 mutex_init(&data->update_lock);
1755 1758
1756 /* Initialize the chip */ 1759 /* Initialize the chip */
1757 w83795_init_client(client); 1760 w83795_init_client(client);
1758 1761
1759 /* Check 795 chip type: 795G or 795ADG */
1760 if (W83795_REG_CONFIG_CONFIG48 &
1761 w83795_read(client, W83795_REG_CONFIG)) {
1762 data->chip_type = w83795adg;
1763 } else {
1764 data->chip_type = w83795g;
1765 }
1766
1767 data->has_in = w83795_read(client, W83795_REG_VOLT_CTRL1); 1762 data->has_in = w83795_read(client, W83795_REG_VOLT_CTRL1);
1768 data->has_in |= w83795_read(client, W83795_REG_VOLT_CTRL2) << 8; 1763 data->has_in |= w83795_read(client, W83795_REG_VOLT_CTRL2) << 8;
1769 /* VSEN11-9 not for 795adg */ 1764 /* VSEN11-9 not for 795adg */
@@ -2097,7 +2092,8 @@ static int w83795_remove(struct i2c_client *client)
2097 2092
2098 2093
2099static const struct i2c_device_id w83795_id[] = { 2094static const struct i2c_device_id w83795_id[] = {
2100 { "w83795", w83795 }, 2095 { "w83795g", w83795g },
2096 { "w83795adg", w83795adg },
2101 { } 2097 { }
2102}; 2098};
2103MODULE_DEVICE_TABLE(i2c, w83795_id); 2099MODULE_DEVICE_TABLE(i2c, w83795_id);