diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-09 22:53:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-09 22:53:11 -0500 |
commit | f71eaf68406cfee91b6a96bcdf7ce33dc78829c5 (patch) | |
tree | 92a1663ae15d521f25849d28ebb4dfad10567892 /drivers/hwmon/tmp421.c | |
parent | 78f1ae193d1662c22cfebb916e788e1ca896c0fe (diff) | |
parent | 54fe4671aa5853ca88da72d67e969a3d8de6dcf6 (diff) |
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (41 commits)
hwmon: (adt7475) Add VID support for the ADT7476
hwmon: (adt7475) Add an entry in MAINTAINERS
hwmon: (adt7475) Add support for the ADT7476
hwmon: (adt7475) Voltage attenuators can be bypassed
hwmon: (adt7475) Print device information on probe
hwmon: (adt7475) Handle alternative pin functions
hwmon: (adt7475) Move sysfs files removal to a separate function
hwmon: (adt7475) Add support for the ADT7490
hwmon: (adt7475) Improve device detection
hwmon: (adt7475) Add missing static marker
hwmon: (adt7475) Rework voltage inputs handling
hwmon: (adt7475) Implement pwm_use_point2_pwm_at_crit
hwmon: (adt7475) New documentation
hwmon: (adt7475) Add support for the ADT7473
hwmon: (f71882fg) Add support for the f71889fg (version 2)
hwmon: (f71882fg) Fix sysfs file removal
hwmon: (f71882fg) Cleanup sysfs attr creation 2/2
hwmon: (f71882fg) Cleanup sysfs attr creation 1/2
hwmon: (thmc50) Stop using I2C_CLIENT_MODULE_PARM
hwmon: Add Freescale MC13783 ADC driver
...
Diffstat (limited to 'drivers/hwmon/tmp421.c')
-rw-r--r-- | drivers/hwmon/tmp421.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 20924343431b..bb5464a289ca 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c | |||
@@ -223,39 +223,36 @@ static int tmp421_init_client(struct i2c_client *client) | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int tmp421_detect(struct i2c_client *client, int kind, | 226 | static int tmp421_detect(struct i2c_client *client, int _kind, |
227 | struct i2c_board_info *info) | 227 | struct i2c_board_info *info) |
228 | { | 228 | { |
229 | enum chips kind; | ||
229 | struct i2c_adapter *adapter = client->adapter; | 230 | struct i2c_adapter *adapter = client->adapter; |
230 | const char *names[] = { "TMP421", "TMP422", "TMP423" }; | 231 | const char *names[] = { "TMP421", "TMP422", "TMP423" }; |
232 | u8 reg; | ||
231 | 233 | ||
232 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 234 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
233 | return -ENODEV; | 235 | return -ENODEV; |
234 | 236 | ||
235 | if (kind <= 0) { | 237 | reg = i2c_smbus_read_byte_data(client, TMP421_MANUFACTURER_ID_REG); |
236 | u8 reg; | 238 | if (reg != TMP421_MANUFACTURER_ID) |
237 | 239 | return -ENODEV; | |
238 | reg = i2c_smbus_read_byte_data(client, | 240 | |
239 | TMP421_MANUFACTURER_ID_REG); | 241 | reg = i2c_smbus_read_byte_data(client, TMP421_DEVICE_ID_REG); |
240 | if (reg != TMP421_MANUFACTURER_ID) | 242 | switch (reg) { |
241 | return -ENODEV; | 243 | case TMP421_DEVICE_ID: |
242 | 244 | kind = tmp421; | |
243 | reg = i2c_smbus_read_byte_data(client, | 245 | break; |
244 | TMP421_DEVICE_ID_REG); | 246 | case TMP422_DEVICE_ID: |
245 | switch (reg) { | 247 | kind = tmp422; |
246 | case TMP421_DEVICE_ID: | 248 | break; |
247 | kind = tmp421; | 249 | case TMP423_DEVICE_ID: |
248 | break; | 250 | kind = tmp423; |
249 | case TMP422_DEVICE_ID: | 251 | break; |
250 | kind = tmp422; | 252 | default: |
251 | break; | 253 | return -ENODEV; |
252 | case TMP423_DEVICE_ID: | ||
253 | kind = tmp423; | ||
254 | break; | ||
255 | default: | ||
256 | return -ENODEV; | ||
257 | } | ||
258 | } | 254 | } |
255 | |||
259 | strlcpy(info->type, tmp421_id[kind - 1].name, I2C_NAME_SIZE); | 256 | strlcpy(info->type, tmp421_id[kind - 1].name, I2C_NAME_SIZE); |
260 | dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n", | 257 | dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n", |
261 | names[kind - 1], client->addr); | 258 | names[kind - 1], client->addr); |