Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
hwmon/applesmc: Handle name file creation error and deletion
hwmon/applesmc: Simplify dependencies
hwmon-vid: Don't spam the logs when VRM version is missing
hwmon/w83627hf: Be quiet when no chip is found
hwmon/coretemp: Add more safety checks
hwmon/ds1621: Fix swapped temperature limits

+46 -11
+1 -1
drivers/hwmon/Kconfig
··· 620 621 config SENSORS_APPLESMC 622 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 623 - depends on HWMON && INPUT && X86 624 select NEW_LEDS 625 select LEDS_CLASS 626 default n
··· 620 621 config SENSORS_APPLESMC 622 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 623 + depends on INPUT && X86 624 select NEW_LEDS 625 select LEDS_CLASS 626 default n
+6 -1
drivers/hwmon/applesmc.c
··· 1206 } 1207 1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); 1209 1210 /* Create key enumeration sysfs files */ 1211 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); 1212 if (ret) 1213 - goto out_device; 1214 1215 /* create fan files */ 1216 count = applesmc_get_fan_count(); ··· 1312 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1313 out_key_enumeration: 1314 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1315 out_device: 1316 platform_device_unregister(pdev); 1317 out_driver: ··· 1339 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1340 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1341 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1342 platform_device_unregister(pdev); 1343 platform_driver_unregister(&applesmc_driver); 1344 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
··· 1206 } 1207 1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); 1209 + if (ret) 1210 + goto out_device; 1211 1212 /* Create key enumeration sysfs files */ 1213 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); 1214 if (ret) 1215 + goto out_name; 1216 1217 /* create fan files */ 1218 count = applesmc_get_fan_count(); ··· 1310 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1311 out_key_enumeration: 1312 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1313 + out_name: 1314 + sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1315 out_device: 1316 platform_device_unregister(pdev); 1317 out_driver: ··· 1335 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1336 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1337 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1338 + sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1339 platform_device_unregister(pdev); 1340 platform_driver_unregister(&applesmc_driver); 1341 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
+29 -3
drivers/hwmon/coretemp.c
··· 176 goto exit_free; 177 } 178 179 /* Some processors have Tjmax 85 following magic should detect it 180 Intel won't disclose the information without signed NDA, but 181 individuals cannot sign it. Catch(ed) 22. ··· 207 } else if (eax & 0x40000000) { 208 data->tjmax = 85000; 209 } 210 } 211 212 platform_set_drvdata(pdev, data); ··· 358 { 359 int i, err = -ENODEV; 360 struct pdev_entry *p, *n; 361 - 362 - printk(KERN_NOTICE DRVNAME ": This driver uses undocumented features " 363 - "of Core CPU. Temperature might be wrong!\n"); 364 365 /* quick check if we run Intel */ 366 if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL)
··· 176 goto exit_free; 177 } 178 179 + /* Check if we have problem with errata AE18 of Core processors: 180 + Readings might stop update when processor visited too deep sleep, 181 + fixed for stepping D0 (6EC). 182 + */ 183 + 184 + if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) { 185 + /* check for microcode update */ 186 + rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx); 187 + if (edx < 0x39) { 188 + dev_err(&pdev->dev, 189 + "Errata AE18 not fixed, update BIOS or " 190 + "microcode of the CPU!\n"); 191 + goto exit_free; 192 + } 193 + } 194 + 195 /* Some processors have Tjmax 85 following magic should detect it 196 Intel won't disclose the information without signed NDA, but 197 individuals cannot sign it. Catch(ed) 22. ··· 191 } else if (eax & 0x40000000) { 192 data->tjmax = 85000; 193 } 194 + } 195 + 196 + /* Intel says that above should not work for desktop Core2 processors, 197 + but it seems to work. There is no other way how get the absolute 198 + readings. Warn the user about this. First check if are desktop, 199 + bit 50 of MSR_IA32_PLATFORM_ID should be 0. 200 + */ 201 + 202 + rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx); 203 + 204 + if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) { 205 + dev_warn(&pdev->dev, "Using undocumented features, absolute " 206 + "temperature might be wrong!\n"); 207 } 208 209 platform_set_drvdata(pdev, data); ··· 329 { 330 int i, err = -ENODEV; 331 struct pdev_entry *p, *n; 332 333 /* quick check if we run Intel */ 334 if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL)
+4 -4
drivers/hwmon/ds1621.c
··· 53 54 /* The DS1621 registers */ 55 #define DS1621_REG_TEMP 0xAA /* word, RO */ 56 - #define DS1621_REG_TEMP_MIN 0xA1 /* word, RW */ 57 - #define DS1621_REG_TEMP_MAX 0xA2 /* word, RW */ 58 #define DS1621_REG_CONF 0xAC /* byte, RW */ 59 #define DS1621_COM_START 0xEE /* no data */ 60 #define DS1621_COM_STOP 0x22 /* no data */ ··· 328 329 /* reset alarms if necessary */ 330 new_conf = data->conf; 331 - if (data->temp < data->temp_min) 332 new_conf &= ~DS1621_ALARM_TEMP_LOW; 333 - if (data->temp > data->temp_max) 334 new_conf &= ~DS1621_ALARM_TEMP_HIGH; 335 if (data->conf != new_conf) 336 ds1621_write_value(client, DS1621_REG_CONF,
··· 53 54 /* The DS1621 registers */ 55 #define DS1621_REG_TEMP 0xAA /* word, RO */ 56 + #define DS1621_REG_TEMP_MIN 0xA2 /* word, RW */ 57 + #define DS1621_REG_TEMP_MAX 0xA1 /* word, RW */ 58 #define DS1621_REG_CONF 0xAC /* byte, RW */ 59 #define DS1621_COM_START 0xEE /* no data */ 60 #define DS1621_COM_STOP 0x22 /* no data */ ··· 328 329 /* reset alarms if necessary */ 330 new_conf = data->conf; 331 + if (data->temp > data->temp_min) 332 new_conf &= ~DS1621_ALARM_TEMP_LOW; 333 + if (data->temp < data->temp_max) 334 new_conf &= ~DS1621_ALARM_TEMP_HIGH; 335 if (data->conf != new_conf) 336 ds1621_write_value(client, DS1621_REG_CONF,
+3 -1
drivers/hwmon/hwmon-vid.c
··· 132 val &= 0x7f; 133 return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000); 134 default: /* report 0 for unknown */ 135 - printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); 136 return 0; 137 } 138 }
··· 132 val &= 0x7f; 133 return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000); 134 default: /* report 0 for unknown */ 135 + if (vrm) 136 + printk(KERN_WARNING "hwmon-vid: Requested unsupported " 137 + "VRM version (%u)\n", (unsigned int)vrm); 138 return 0; 139 } 140 }
+3 -1
drivers/hwmon/w83627hf.c
··· 965 case W687THF_DEVID: 966 sio_data->type = w83687thf; 967 break; 968 default: 969 - pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n", val); 970 goto exit; 971 } 972
··· 965 case W687THF_DEVID: 966 sio_data->type = w83687thf; 967 break; 968 + case 0xff: /* No device at all */ 969 + goto exit; 970 default: 971 + pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%02x)\n", val); 972 goto exit; 973 } 974