Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6

* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
hwmon: (adt7473) minor cleanup / refactoring
hwmon: (asb100) Remove some dead code
hwmon: (lm75) Fix an incorrect comment
hwmon: (w83793) VID and VRM handling cleanups
hwmon: (w83l785ts) Don't ask the user to report failures
hwmon: (smsc47b397) add a new chip id (0x8c)

+56 -48
+2 -1
Documentation/hwmon/w83l785ts
··· 33 33 ------------ 34 34 35 35 On some systems (Asus), the BIOS is known to interfere with the driver 36 - and cause read errors. The driver will retry a given number of times 36 + and cause read errors. Or maybe the W83L785TS-S chip is simply unreliable, 37 + we don't really know. The driver will retry a given number of times 37 38 (5 by default) and then give up, returning the old value (or 0 if 38 39 there is no old value). It seems to work well enough so that you should 39 40 not notice anything. Thanks to James Bolt for helping test this feature.
+23 -22
drivers/hwmon/adt7473.c
··· 422 422 * number in the range -128 to 127, or as an unsigned number that must 423 423 * be offset by 64. 424 424 */ 425 - static int decode_temp(struct adt7473_data *data, u8 raw) 425 + static int decode_temp(u8 twos_complement, u8 raw) 426 426 { 427 - if (data->temp_twos_complement) 428 - return (s8)raw; 429 - return raw - 64; 427 + return twos_complement ? (s8)raw : raw - 64; 430 428 } 431 429 432 - static u8 encode_temp(struct adt7473_data *data, int cooked) 430 + static u8 encode_temp(u8 twos_complement, int cooked) 433 431 { 434 - if (data->temp_twos_complement) 435 - return (cooked & 0xFF); 436 - return cooked + 64; 432 + return twos_complement ? cooked & 0xFF : cooked + 64; 437 433 } 438 434 439 435 static ssize_t show_temp_min(struct device *dev, ··· 438 442 { 439 443 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 440 444 struct adt7473_data *data = adt7473_update_device(dev); 441 - return sprintf(buf, "%d\n", 442 - 1000 * decode_temp(data, data->temp_min[attr->index])); 445 + return sprintf(buf, "%d\n", 1000 * decode_temp( 446 + data->temp_twos_complement, 447 + data->temp_min[attr->index])); 443 448 } 444 449 445 450 static ssize_t set_temp_min(struct device *dev, ··· 452 455 struct i2c_client *client = to_i2c_client(dev); 453 456 struct adt7473_data *data = i2c_get_clientdata(client); 454 457 int temp = simple_strtol(buf, NULL, 10) / 1000; 455 - temp = encode_temp(data, temp); 458 + temp = encode_temp(data->temp_twos_complement, temp); 456 459 457 460 mutex_lock(&data->lock); 458 461 data->temp_min[attr->index] = temp; ··· 469 472 { 470 473 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 471 474 struct adt7473_data *data = adt7473_update_device(dev); 472 - return sprintf(buf, "%d\n", 473 - 1000 * decode_temp(data, data->temp_max[attr->index])); 475 + return sprintf(buf, "%d\n", 1000 * decode_temp( 476 + data->temp_twos_complement, 477 + data->temp_max[attr->index])); 474 478 } 475 479 476 480 static ssize_t set_temp_max(struct device *dev, ··· 483 485 struct i2c_client *client = to_i2c_client(dev); 484 486 struct adt7473_data *data = i2c_get_clientdata(client); 485 487 int temp = simple_strtol(buf, NULL, 10) / 1000; 486 - temp = encode_temp(data, temp); 488 + temp = encode_temp(data->temp_twos_complement, temp); 487 489 488 490 mutex_lock(&data->lock); 489 491 data->temp_max[attr->index] = temp; ··· 499 501 { 500 502 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 501 503 struct adt7473_data *data = adt7473_update_device(dev); 502 - return sprintf(buf, "%d\n", 503 - 1000 * decode_temp(data, data->temp[attr->index])); 504 + return sprintf(buf, "%d\n", 1000 * decode_temp( 505 + data->temp_twos_complement, 506 + data->temp[attr->index])); 504 507 } 505 508 506 509 static ssize_t show_fan_min(struct device *dev, ··· 670 671 { 671 672 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 672 673 struct adt7473_data *data = adt7473_update_device(dev); 673 - return sprintf(buf, "%d\n", 674 - 1000 * decode_temp(data, data->temp_tmax[attr->index])); 674 + return sprintf(buf, "%d\n", 1000 * decode_temp( 675 + data->temp_twos_complement, 676 + data->temp_tmax[attr->index])); 675 677 } 676 678 677 679 static ssize_t set_temp_tmax(struct device *dev, ··· 684 684 struct i2c_client *client = to_i2c_client(dev); 685 685 struct adt7473_data *data = i2c_get_clientdata(client); 686 686 int temp = simple_strtol(buf, NULL, 10) / 1000; 687 - temp = encode_temp(data, temp); 687 + temp = encode_temp(data->temp_twos_complement, temp); 688 688 689 689 mutex_lock(&data->lock); 690 690 data->temp_tmax[attr->index] = temp; ··· 701 701 { 702 702 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 703 703 struct adt7473_data *data = adt7473_update_device(dev); 704 - return sprintf(buf, "%d\n", 705 - 1000 * decode_temp(data, data->temp_tmin[attr->index])); 704 + return sprintf(buf, "%d\n", 1000 * decode_temp( 705 + data->temp_twos_complement, 706 + data->temp_tmin[attr->index])); 706 707 } 707 708 708 709 static ssize_t set_temp_tmin(struct device *dev, ··· 715 714 struct i2c_client *client = to_i2c_client(dev); 716 715 struct adt7473_data *data = i2c_get_clientdata(client); 717 716 int temp = simple_strtol(buf, NULL, 10) / 1000; 718 - temp = encode_temp(data, temp); 717 + temp = encode_temp(data->temp_twos_complement, temp); 719 718 720 719 mutex_lock(&data->lock); 721 720 data->temp_tmin[attr->index] = temp;
-4
drivers/hwmon/asb100.c
··· 953 953 static void asb100_init_client(struct i2c_client *client) 954 954 { 955 955 struct asb100_data *data = i2c_get_clientdata(client); 956 - int vid = 0; 957 956 958 - vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f; 959 - vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4; 960 957 data->vrm = vid_which_vrm(); 961 - vid = vid_from_reg(vid, data->vrm); 962 958 963 959 /* Start monitoring */ 964 960 asb100_write_value(client, ASB100_REG_CONFIG,
+1 -4
drivers/hwmon/lm75.c
··· 248 248 249 249 /* All registers are word-sized, except for the configuration register. 250 250 LM75 uses a high-byte first convention, which is exactly opposite to 251 - the usual practice. */ 251 + the SMBus standard. */ 252 252 static int lm75_read_value(struct i2c_client *client, u8 reg) 253 253 { 254 254 if (reg == LM75_REG_CONF) ··· 257 257 return swab16(i2c_smbus_read_word_data(client, reg)); 258 258 } 259 259 260 - /* All registers are word-sized, except for the configuration register. 261 - LM75 uses a high-byte first convention, which is exactly opposite to 262 - the usual practice. */ 263 260 static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) 264 261 { 265 262 if (reg == LM75_REG_CONF)
+14 -3
drivers/hwmon/smsc47b397.c
··· 335 335 static int __init smsc47b397_find(unsigned short *addr) 336 336 { 337 337 u8 id, rev; 338 + char *name; 338 339 339 340 superio_enter(); 340 341 id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); 341 342 342 - if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) { 343 + switch(id) { 344 + case 0x81: 345 + name = "SCH5307-NS"; 346 + break; 347 + case 0x6f: 348 + name = "LPC47B397-NC"; 349 + break; 350 + case 0x85: 351 + case 0x8c: 352 + name = "SCH5317"; 353 + break; 354 + default: 343 355 superio_exit(); 344 356 return -ENODEV; 345 357 } ··· 364 352 365 353 printk(KERN_INFO DRVNAME ": found SMSC %s " 366 354 "(base address 0x%04x, revision %u)\n", 367 - id == 0x81 ? "SCH5307-NS" : id == 0x85 ? "SCH5317" : 368 - "LPC47B397-NC", *addr, rev); 355 + name, *addr, rev); 369 356 370 357 superio_exit(); 371 358 return 0;
+14 -12
drivers/hwmon/w83793.c
··· 1024 1024 SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), 1025 1025 SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), 1026 1026 }; 1027 + static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); 1027 1028 1028 1029 static struct sensor_device_attribute_2 sda_single_files[] = { 1029 - SENSOR_ATTR_2(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm, 1030 - NOT_USED, NOT_USED), 1031 1030 SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, 1032 1031 store_chassis_clear, ALARM_STATUS, 30), 1033 1032 SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, ··· 1079 1080 1080 1081 for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) 1081 1082 device_remove_file(dev, &w83793_vid[i].dev_attr); 1083 + device_remove_file(dev, &dev_attr_vrm); 1082 1084 1083 1085 for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) 1084 1086 device_remove_file(dev, &w83793_left_fan[i].dev_attr); ··· 1282 1282 /* Initialize the chip */ 1283 1283 w83793_init_client(client); 1284 1284 1285 - data->vrm = vid_which_vrm(); 1286 1285 /* 1287 1286 Only fan 1-5 has their own input pins, 1288 1287 Pwm 1-3 has their own pins ··· 1292 1293 val = w83793_read_value(client, W83793_REG_FANIN_CTRL); 1293 1294 1294 1295 /* check the function of pins 49-56 */ 1295 - if (!(tmp & 0x80)) { 1296 + if (tmp & 0x80) { 1297 + data->has_vid |= 0x2; /* has VIDB */ 1298 + } else { 1296 1299 data->has_pwm |= 0x18; /* pwm 4,5 */ 1297 1300 if (val & 0x01) { /* fan 6 */ 1298 1301 data->has_fan |= 0x20; ··· 1310 1309 } 1311 1310 } 1312 1311 1312 + /* check the function of pins 37-40 */ 1313 + if (!(tmp & 0x29)) 1314 + data->has_vid |= 0x1; /* has VIDA */ 1313 1315 if (0x08 == (tmp & 0x0c)) { 1314 1316 if (val & 0x08) /* fan 9 */ 1315 1317 data->has_fan |= 0x100; 1316 1318 if (val & 0x10) /* fan 10 */ 1317 1319 data->has_fan |= 0x200; 1318 1320 } 1319 - 1320 1321 if (0x20 == (tmp & 0x30)) { 1321 1322 if (val & 0x20) /* fan 11 */ 1322 1323 data->has_fan |= 0x400; ··· 1362 1359 if (tmp & 0x02) 1363 1360 data->has_temp |= 0x20; 1364 1361 1365 - /* Detect the VID usage and ignore unused input */ 1366 - tmp = w83793_read_value(client, W83793_REG_MFC); 1367 - if (!(tmp & 0x29)) 1368 - data->has_vid |= 0x1; /* has VIDA */ 1369 - if (tmp & 0x80) 1370 - data->has_vid |= 0x2; /* has VIDB */ 1371 - 1372 1362 /* Register sysfs hooks */ 1373 1363 for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { 1374 1364 err = device_create_file(dev, ··· 1374 1378 if (!(data->has_vid & (1 << i))) 1375 1379 continue; 1376 1380 err = device_create_file(dev, &w83793_vid[i].dev_attr); 1381 + if (err) 1382 + goto exit_remove; 1383 + } 1384 + if (data->has_vid) { 1385 + data->vrm = vid_which_vrm(); 1386 + err = device_create_file(dev, &dev_attr_vrm); 1377 1387 if (err) 1378 1388 goto exit_remove; 1379 1389 }
+2 -2
drivers/hwmon/w83l785ts.c
··· 301 301 msleep(i); 302 302 } 303 303 304 - dev_err(&client->dev, "Couldn't read value from register 0x%02x. " 305 - "Please report.\n", reg); 304 + dev_err(&client->dev, "Couldn't read value from register 0x%02x.\n", 305 + reg); 306 306 return defval; 307 307 } 308 308