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