Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
x86/hwmon: pkgtemp has no dependency on PCI
MAINTAINERS: Update hwmon entry
x86/hwmon: register alternate sibling upon CPU removal
x86/hwmon: fix initialization of pkgtemp
x86/hwmon: fix initialization of coretemp
x86/hwmon: don't leak device attribute file from pkgtemp_probe() and pkgtemp_remove()
x86/hwmon: avoid deadlock on CPU removal in pkgtemp
x86/hwmon: fix module init for hotplug-but-no-device-found case
hwmon: (lis3) Fix Oops with NULL platform data

+50 -39
+2
MAINTAINERS
··· 2668 L: lm-sensors@lm-sensors.org 2669 W: http://www.lm-sensors.org/ 2670 T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ 2671 S: Maintained 2672 F: Documentation/hwmon/ 2673 F: drivers/hwmon/
··· 2668 L: lm-sensors@lm-sensors.org 2669 W: http://www.lm-sensors.org/ 2670 T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ 2671 + T: quilt kernel.org/pub/linux/kernel/people/groeck/linux-staging/ 2672 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 2673 S: Maintained 2674 F: Documentation/hwmon/ 2675 F: drivers/hwmon/
+1
arch/x86/include/asm/cpufeature.h
··· 168 #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ 169 #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ 170 #define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ 171 172 /* Virtualization flags: Linux defined, word 8 */ 173 #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
··· 168 #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ 169 #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ 170 #define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ 171 + #define X86_FEATURE_DTS (7*32+ 7) /* Digital Thermal Sensor */ 172 173 /* Virtualization flags: Linux defined, word 8 */ 174 #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
+1
arch/x86/kernel/cpu/scattered.c
··· 31 const struct cpuid_bit *cb; 32 33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { 34 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, 35 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 36 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 },
··· 31 const struct cpuid_bit *cb; 32 33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { 34 + { X86_FEATURE_DTS, CR_EAX, 0, 0x00000006, 0 }, 35 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, 36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 37 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 },
+1 -1
drivers/hwmon/Kconfig
··· 409 410 config SENSORS_PKGTEMP 411 tristate "Intel processor package temperature sensor" 412 - depends on X86 && PCI && EXPERIMENTAL 413 help 414 If you say yes here you get support for the package level temperature 415 sensor inside your CPU. Check documentation/driver for details.
··· 409 410 config SENSORS_PKGTEMP 411 tristate "Intel processor package temperature sensor" 412 + depends on X86 && EXPERIMENTAL 413 help 414 If you say yes here you get support for the package level temperature 415 sensor inside your CPU. Check documentation/driver for details.
+32 -24
drivers/hwmon/coretemp.c
··· 423 int err; 424 struct platform_device *pdev; 425 struct pdev_entry *pdev_entry; 426 - #ifdef CONFIG_SMP 427 struct cpuinfo_x86 *c = &cpu_data(cpu); 428 - #endif 429 430 mutex_lock(&pdev_list_mutex); 431 ··· 491 492 static void coretemp_device_remove(unsigned int cpu) 493 { 494 - struct pdev_entry *p, *n; 495 mutex_lock(&pdev_list_mutex); 496 - list_for_each_entry_safe(p, n, &pdev_list, list) { 497 - if (p->cpu == cpu) { 498 - platform_device_unregister(p->pdev); 499 - list_del(&p->list); 500 - kfree(p); 501 - } 502 } 503 mutex_unlock(&pdev_list_mutex); 504 } ··· 544 if (err) 545 goto exit; 546 547 - for_each_online_cpu(i) { 548 - struct cpuinfo_x86 *c = &cpu_data(i); 549 - /* 550 - * CPUID.06H.EAX[0] indicates whether the CPU has thermal 551 - * sensors. We check this bit only, all the early CPUs 552 - * without thermal sensors will be filtered out. 553 - */ 554 - if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) 555 - coretemp_device_add(i); 556 - else { 557 - printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" 558 - " has no thermal sensor.\n", c->x86_model); 559 - } 560 - } 561 if (list_empty(&pdev_list)) { 562 err = -ENODEV; 563 goto exit_driver_unreg; 564 } 565 566 register_hotcpu_notifier(&coretemp_cpu_notifier); 567 return 0; 568 569 - exit_driver_unreg: 570 #ifndef CONFIG_HOTPLUG_CPU 571 platform_driver_unregister(&coretemp_driver); 572 #endif 573 exit:
··· 423 int err; 424 struct platform_device *pdev; 425 struct pdev_entry *pdev_entry; 426 struct cpuinfo_x86 *c = &cpu_data(cpu); 427 + 428 + /* 429 + * CPUID.06H.EAX[0] indicates whether the CPU has thermal 430 + * sensors. We check this bit only, all the early CPUs 431 + * without thermal sensors will be filtered out. 432 + */ 433 + if (!cpu_has(c, X86_FEATURE_DTS)) { 434 + printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" 435 + " has no thermal sensor.\n", c->x86_model); 436 + return 0; 437 + } 438 439 mutex_lock(&pdev_list_mutex); 440 ··· 482 483 static void coretemp_device_remove(unsigned int cpu) 484 { 485 + struct pdev_entry *p; 486 + unsigned int i; 487 + 488 mutex_lock(&pdev_list_mutex); 489 + list_for_each_entry(p, &pdev_list, list) { 490 + if (p->cpu != cpu) 491 + continue; 492 + 493 + platform_device_unregister(p->pdev); 494 + list_del(&p->list); 495 + mutex_unlock(&pdev_list_mutex); 496 + kfree(p); 497 + for_each_cpu(i, cpu_sibling_mask(cpu)) 498 + if (i != cpu && !coretemp_device_add(i)) 499 + break; 500 + return; 501 } 502 mutex_unlock(&pdev_list_mutex); 503 } ··· 527 if (err) 528 goto exit; 529 530 + for_each_online_cpu(i) 531 + coretemp_device_add(i); 532 + 533 + #ifndef CONFIG_HOTPLUG_CPU 534 if (list_empty(&pdev_list)) { 535 err = -ENODEV; 536 goto exit_driver_unreg; 537 } 538 + #endif 539 540 register_hotcpu_notifier(&coretemp_cpu_notifier); 541 return 0; 542 543 #ifndef CONFIG_HOTPLUG_CPU 544 + exit_driver_unreg: 545 platform_driver_unregister(&coretemp_driver); 546 #endif 547 exit:
+2 -2
drivers/hwmon/lis3lv02d.c
··· 277 wake_up_interruptible(&lis3_dev.misc_wait); 278 kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); 279 out: 280 - if (lis3_dev.whoami == WAI_8B && lis3_dev.idev && 281 lis3_dev.idev->input->users) 282 return IRQ_WAKE_THREAD; 283 return IRQ_HANDLED; ··· 718 * io-apic is not configurable (and generates a warning) but I keep it 719 * in case of support for other hardware. 720 */ 721 - if (dev->whoami == WAI_8B) 722 thread_fn = lis302dl_interrupt_thread1_8b; 723 else 724 thread_fn = NULL;
··· 277 wake_up_interruptible(&lis3_dev.misc_wait); 278 kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); 279 out: 280 + if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev && 281 lis3_dev.idev->input->users) 282 return IRQ_WAKE_THREAD; 283 return IRQ_HANDLED; ··· 718 * io-apic is not configurable (and generates a warning) but I keep it 719 * in case of support for other hardware. 720 */ 721 + if (dev->pdata && dev->whoami == WAI_8B) 722 thread_fn = lis302dl_interrupt_thread1_8b; 723 else 724 thread_fn = NULL;
+11 -12
drivers/hwmon/pkgtemp.c
··· 33 #include <linux/list.h> 34 #include <linux/platform_device.h> 35 #include <linux/cpu.h> 36 - #include <linux/pci.h> 37 #include <asm/msr.h> 38 #include <asm/processor.h> 39 ··· 223 224 err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); 225 if (err) 226 - goto exit_free; 227 228 data->hwmon_dev = hwmon_device_register(&pdev->dev); 229 if (IS_ERR(data->hwmon_dev)) { ··· 237 238 exit_class: 239 sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); 240 exit_free: 241 kfree(data); 242 exit: ··· 251 252 hwmon_device_unregister(data->hwmon_dev); 253 sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); 254 platform_set_drvdata(pdev, NULL); 255 kfree(data); 256 return 0; ··· 283 int err; 284 struct platform_device *pdev; 285 struct pdev_entry *pdev_entry; 286 - #ifdef CONFIG_SMP 287 struct cpuinfo_x86 *c = &cpu_data(cpu); 288 - #endif 289 290 mutex_lock(&pdev_list_mutex); 291 ··· 342 #ifdef CONFIG_HOTPLUG_CPU 343 static void pkgtemp_device_remove(unsigned int cpu) 344 { 345 - struct pdev_entry *p, *n; 346 unsigned int i; 347 int err; 348 349 mutex_lock(&pdev_list_mutex); 350 - list_for_each_entry_safe(p, n, &pdev_list, list) { 351 if (p->cpu != cpu) 352 continue; 353 354 platform_device_unregister(p->pdev); 355 list_del(&p->list); 356 kfree(p); 357 for_each_cpu(i, cpu_core_mask(cpu)) { 358 if (i != cpu) { ··· 362 break; 363 } 364 } 365 - break; 366 } 367 mutex_unlock(&pdev_list_mutex); 368 } ··· 403 goto exit; 404 405 for_each_online_cpu(i) { 406 - struct cpuinfo_x86 *c = &cpu_data(i); 407 - 408 - if (!cpu_has(c, X86_FEATURE_PTS)) 409 - continue; 410 - 411 err = pkgtemp_device_add(i); 412 if (err) 413 goto exit_devices_unreg;
··· 33 #include <linux/list.h> 34 #include <linux/platform_device.h> 35 #include <linux/cpu.h> 36 #include <asm/msr.h> 37 #include <asm/processor.h> 38 ··· 224 225 err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); 226 if (err) 227 + goto exit_dev; 228 229 data->hwmon_dev = hwmon_device_register(&pdev->dev); 230 if (IS_ERR(data->hwmon_dev)) { ··· 238 239 exit_class: 240 sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); 241 + exit_dev: 242 + device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); 243 exit_free: 244 kfree(data); 245 exit: ··· 250 251 hwmon_device_unregister(data->hwmon_dev); 252 sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); 253 + device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); 254 platform_set_drvdata(pdev, NULL); 255 kfree(data); 256 return 0; ··· 281 int err; 282 struct platform_device *pdev; 283 struct pdev_entry *pdev_entry; 284 struct cpuinfo_x86 *c = &cpu_data(cpu); 285 + 286 + if (!cpu_has(c, X86_FEATURE_PTS)) 287 + return 0; 288 289 mutex_lock(&pdev_list_mutex); 290 ··· 339 #ifdef CONFIG_HOTPLUG_CPU 340 static void pkgtemp_device_remove(unsigned int cpu) 341 { 342 + struct pdev_entry *p; 343 unsigned int i; 344 int err; 345 346 mutex_lock(&pdev_list_mutex); 347 + list_for_each_entry(p, &pdev_list, list) { 348 if (p->cpu != cpu) 349 continue; 350 351 platform_device_unregister(p->pdev); 352 list_del(&p->list); 353 + mutex_unlock(&pdev_list_mutex); 354 kfree(p); 355 for_each_cpu(i, cpu_core_mask(cpu)) { 356 if (i != cpu) { ··· 358 break; 359 } 360 } 361 + return; 362 } 363 mutex_unlock(&pdev_list_mutex); 364 } ··· 399 goto exit; 400 401 for_each_online_cpu(i) { 402 err = pkgtemp_device_add(i); 403 if (err) 404 goto exit_devices_unreg;