diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-24 22:09:20 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-24 22:09:20 -0400 |
| commit | 8ae09259ffe2402e956efd5a36220b6161e9ecb3 (patch) | |
| tree | 05445becce71e6dac507bcc15f55487bbf3e2f17 | |
| parent | fd194e6493be47bd491931d19f563f59b54fd769 (diff) | |
| parent | 0eae7799000cdf0c2ed596c39bfb71030809fc71 (diff) | |
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
| -rw-r--r-- | MAINTAINERS | 2 | ||||
| -rw-r--r-- | arch/x86/include/asm/cpufeature.h | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/scattered.c | 1 | ||||
| -rw-r--r-- | drivers/hwmon/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/hwmon/coretemp.c | 56 | ||||
| -rw-r--r-- | drivers/hwmon/lis3lv02d.c | 4 | ||||
| -rw-r--r-- | drivers/hwmon/pkgtemp.c | 23 |
7 files changed, 50 insertions, 39 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index df342839b8c1..ceba39bc1b49 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2668,6 +2668,8 @@ M: Guenter Roeck <guenter.roeck@ericsson.com> | |||
| 2668 | L: lm-sensors@lm-sensors.org | 2668 | L: lm-sensors@lm-sensors.org |
| 2669 | W: http://www.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/ | 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 | S: Maintained | 2673 | S: Maintained |
| 2672 | F: Documentation/hwmon/ | 2674 | F: Documentation/hwmon/ |
| 2673 | F: drivers/hwmon/ | 2675 | F: drivers/hwmon/ |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index c6fbb7b430d1..3f76523589af 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
| @@ -168,6 +168,7 @@ | |||
| 168 | #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ | 168 | #define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ |
| 169 | #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ | 169 | #define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ |
| 170 | #define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ | 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 | /* Virtualization flags: Linux defined, word 8 */ | 173 | /* Virtualization flags: Linux defined, word 8 */ |
| 173 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ | 174 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ |
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 34b4dad6f0b8..d49079515122 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c | |||
| @@ -31,6 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
| 31 | const struct cpuid_bit *cb; | 31 | const struct cpuid_bit *cb; |
| 32 | 32 | ||
| 33 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 33 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
| 34 | { X86_FEATURE_DTS, CR_EAX, 0, 0x00000006, 0 }, | ||
| 34 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, | 35 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, |
| 35 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, | 36 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, |
| 36 | { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, | 37 | { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4d4d09bdec0a..97499d00615a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -409,7 +409,7 @@ config SENSORS_CORETEMP | |||
| 409 | 409 | ||
| 410 | config SENSORS_PKGTEMP | 410 | config SENSORS_PKGTEMP |
| 411 | tristate "Intel processor package temperature sensor" | 411 | tristate "Intel processor package temperature sensor" |
| 412 | depends on X86 && PCI && EXPERIMENTAL | 412 | depends on X86 && EXPERIMENTAL |
| 413 | help | 413 | help |
| 414 | If you say yes here you get support for the package level temperature | 414 | If you say yes here you get support for the package level temperature |
| 415 | sensor inside your CPU. Check documentation/driver for details. | 415 | sensor inside your CPU. Check documentation/driver for details. |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index de8111114f46..baa842a80b4b 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -423,9 +423,18 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
| 423 | int err; | 423 | int err; |
| 424 | struct platform_device *pdev; | 424 | struct platform_device *pdev; |
| 425 | struct pdev_entry *pdev_entry; | 425 | struct pdev_entry *pdev_entry; |
| 426 | #ifdef CONFIG_SMP | ||
| 427 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 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 | mutex_lock(&pdev_list_mutex); | 439 | mutex_lock(&pdev_list_mutex); |
| 431 | 440 | ||
| @@ -482,14 +491,22 @@ exit: | |||
| 482 | 491 | ||
| 483 | static void coretemp_device_remove(unsigned int cpu) | 492 | static void coretemp_device_remove(unsigned int cpu) |
| 484 | { | 493 | { |
| 485 | struct pdev_entry *p, *n; | 494 | struct pdev_entry *p; |
| 495 | unsigned int i; | ||
| 496 | |||
| 486 | mutex_lock(&pdev_list_mutex); | 497 | mutex_lock(&pdev_list_mutex); |
| 487 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 498 | list_for_each_entry(p, &pdev_list, list) { |
| 488 | if (p->cpu == cpu) { | 499 | if (p->cpu != cpu) |
| 489 | platform_device_unregister(p->pdev); | 500 | continue; |
| 490 | list_del(&p->list); | 501 | |
| 491 | kfree(p); | 502 | platform_device_unregister(p->pdev); |
| 492 | } | 503 | list_del(&p->list); |
| 504 | mutex_unlock(&pdev_list_mutex); | ||
| 505 | kfree(p); | ||
| 506 | for_each_cpu(i, cpu_sibling_mask(cpu)) | ||
| 507 | if (i != cpu && !coretemp_device_add(i)) | ||
| 508 | break; | ||
| 509 | return; | ||
| 493 | } | 510 | } |
| 494 | mutex_unlock(&pdev_list_mutex); | 511 | mutex_unlock(&pdev_list_mutex); |
| 495 | } | 512 | } |
| @@ -527,30 +544,21 @@ static int __init coretemp_init(void) | |||
| 527 | if (err) | 544 | if (err) |
| 528 | goto exit; | 545 | goto exit; |
| 529 | 546 | ||
| 530 | for_each_online_cpu(i) { | 547 | for_each_online_cpu(i) |
| 531 | struct cpuinfo_x86 *c = &cpu_data(i); | 548 | coretemp_device_add(i); |
| 532 | /* | 549 | |
| 533 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal | 550 | #ifndef CONFIG_HOTPLUG_CPU |
| 534 | * sensors. We check this bit only, all the early CPUs | ||
| 535 | * without thermal sensors will be filtered out. | ||
| 536 | */ | ||
| 537 | if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) | ||
| 538 | coretemp_device_add(i); | ||
| 539 | else { | ||
| 540 | printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" | ||
| 541 | " has no thermal sensor.\n", c->x86_model); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | if (list_empty(&pdev_list)) { | 551 | if (list_empty(&pdev_list)) { |
| 545 | err = -ENODEV; | 552 | err = -ENODEV; |
| 546 | goto exit_driver_unreg; | 553 | goto exit_driver_unreg; |
| 547 | } | 554 | } |
| 555 | #endif | ||
| 548 | 556 | ||
| 549 | register_hotcpu_notifier(&coretemp_cpu_notifier); | 557 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
| 550 | return 0; | 558 | return 0; |
| 551 | 559 | ||
| 552 | exit_driver_unreg: | ||
| 553 | #ifndef CONFIG_HOTPLUG_CPU | 560 | #ifndef CONFIG_HOTPLUG_CPU |
| 561 | exit_driver_unreg: | ||
| 554 | platform_driver_unregister(&coretemp_driver); | 562 | platform_driver_unregister(&coretemp_driver); |
| 555 | #endif | 563 | #endif |
| 556 | exit: | 564 | exit: |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 6138f036b159..fc591ae53107 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
| @@ -277,7 +277,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy) | |||
| 277 | wake_up_interruptible(&lis3_dev.misc_wait); | 277 | wake_up_interruptible(&lis3_dev.misc_wait); |
| 278 | kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); | 278 | kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); |
| 279 | out: | 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 | lis3_dev.idev->input->users) | 281 | lis3_dev.idev->input->users) |
| 282 | return IRQ_WAKE_THREAD; | 282 | return IRQ_WAKE_THREAD; |
| 283 | return IRQ_HANDLED; | 283 | return IRQ_HANDLED; |
| @@ -718,7 +718,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) | |||
| 718 | * io-apic is not configurable (and generates a warning) but I keep it | 718 | * io-apic is not configurable (and generates a warning) but I keep it |
| 719 | * in case of support for other hardware. | 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 | thread_fn = lis302dl_interrupt_thread1_8b; | 722 | thread_fn = lis302dl_interrupt_thread1_8b; |
| 723 | else | 723 | else |
| 724 | thread_fn = NULL; | 724 | thread_fn = NULL; |
diff --git a/drivers/hwmon/pkgtemp.c b/drivers/hwmon/pkgtemp.c index 74157fcda6ed..f11903936c8b 100644 --- a/drivers/hwmon/pkgtemp.c +++ b/drivers/hwmon/pkgtemp.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
| 34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
| 35 | #include <linux/cpu.h> | 35 | #include <linux/cpu.h> |
| 36 | #include <linux/pci.h> | ||
| 37 | #include <asm/msr.h> | 36 | #include <asm/msr.h> |
| 38 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
| 39 | 38 | ||
| @@ -224,7 +223,7 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 224 | 223 | ||
| 225 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); | 224 | err = sysfs_create_group(&pdev->dev.kobj, &pkgtemp_group); |
| 226 | if (err) | 225 | if (err) |
| 227 | goto exit_free; | 226 | goto exit_dev; |
| 228 | 227 | ||
| 229 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 228 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
| 230 | if (IS_ERR(data->hwmon_dev)) { | 229 | if (IS_ERR(data->hwmon_dev)) { |
| @@ -238,6 +237,8 @@ static int __devinit pkgtemp_probe(struct platform_device *pdev) | |||
| 238 | 237 | ||
| 239 | exit_class: | 238 | exit_class: |
| 240 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 239 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 240 | exit_dev: | ||
| 241 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 241 | exit_free: | 242 | exit_free: |
| 242 | kfree(data); | 243 | kfree(data); |
| 243 | exit: | 244 | exit: |
| @@ -250,6 +251,7 @@ static int __devexit pkgtemp_remove(struct platform_device *pdev) | |||
| 250 | 251 | ||
| 251 | hwmon_device_unregister(data->hwmon_dev); | 252 | hwmon_device_unregister(data->hwmon_dev); |
| 252 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); | 253 | sysfs_remove_group(&pdev->dev.kobj, &pkgtemp_group); |
| 254 | device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); | ||
| 253 | platform_set_drvdata(pdev, NULL); | 255 | platform_set_drvdata(pdev, NULL); |
| 254 | kfree(data); | 256 | kfree(data); |
| 255 | return 0; | 257 | return 0; |
| @@ -281,9 +283,10 @@ static int __cpuinit pkgtemp_device_add(unsigned int cpu) | |||
| 281 | int err; | 283 | int err; |
| 282 | struct platform_device *pdev; | 284 | struct platform_device *pdev; |
| 283 | struct pdev_entry *pdev_entry; | 285 | struct pdev_entry *pdev_entry; |
| 284 | #ifdef CONFIG_SMP | ||
| 285 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 286 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 286 | #endif | 287 | |
| 288 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 289 | return 0; | ||
| 287 | 290 | ||
| 288 | mutex_lock(&pdev_list_mutex); | 291 | mutex_lock(&pdev_list_mutex); |
| 289 | 292 | ||
| @@ -339,17 +342,18 @@ exit: | |||
| 339 | #ifdef CONFIG_HOTPLUG_CPU | 342 | #ifdef CONFIG_HOTPLUG_CPU |
| 340 | static void pkgtemp_device_remove(unsigned int cpu) | 343 | static void pkgtemp_device_remove(unsigned int cpu) |
| 341 | { | 344 | { |
| 342 | struct pdev_entry *p, *n; | 345 | struct pdev_entry *p; |
| 343 | unsigned int i; | 346 | unsigned int i; |
| 344 | int err; | 347 | int err; |
| 345 | 348 | ||
| 346 | mutex_lock(&pdev_list_mutex); | 349 | mutex_lock(&pdev_list_mutex); |
| 347 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 350 | list_for_each_entry(p, &pdev_list, list) { |
| 348 | if (p->cpu != cpu) | 351 | if (p->cpu != cpu) |
| 349 | continue; | 352 | continue; |
| 350 | 353 | ||
| 351 | platform_device_unregister(p->pdev); | 354 | platform_device_unregister(p->pdev); |
| 352 | list_del(&p->list); | 355 | list_del(&p->list); |
| 356 | mutex_unlock(&pdev_list_mutex); | ||
| 353 | kfree(p); | 357 | kfree(p); |
| 354 | for_each_cpu(i, cpu_core_mask(cpu)) { | 358 | for_each_cpu(i, cpu_core_mask(cpu)) { |
| 355 | if (i != cpu) { | 359 | if (i != cpu) { |
| @@ -358,7 +362,7 @@ static void pkgtemp_device_remove(unsigned int cpu) | |||
| 358 | break; | 362 | break; |
| 359 | } | 363 | } |
| 360 | } | 364 | } |
| 361 | break; | 365 | return; |
| 362 | } | 366 | } |
| 363 | mutex_unlock(&pdev_list_mutex); | 367 | mutex_unlock(&pdev_list_mutex); |
| 364 | } | 368 | } |
| @@ -399,11 +403,6 @@ static int __init pkgtemp_init(void) | |||
| 399 | goto exit; | 403 | goto exit; |
| 400 | 404 | ||
| 401 | for_each_online_cpu(i) { | 405 | for_each_online_cpu(i) { |
| 402 | struct cpuinfo_x86 *c = &cpu_data(i); | ||
| 403 | |||
| 404 | if (!cpu_has(c, X86_FEATURE_PTS)) | ||
| 405 | continue; | ||
| 406 | |||
| 407 | err = pkgtemp_device_add(i); | 406 | err = pkgtemp_device_add(i); |
| 408 | if (err) | 407 | if (err) |
| 409 | goto exit_devices_unreg; | 408 | goto exit_devices_unreg; |
