aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-03 15:54:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-03 15:54:56 -0400
commit0f86267b79bc6e357b8606077c7f70239045ea9c (patch)
treef31af517e9b40e360180dfb4679de866a2ad2bb2 /drivers
parent0d617928f5f5426f6e40edaacbfa80e73d67e0cd (diff)
parent20ecb499f64a7e8e7fe03f6098ab25c71b7a6481 (diff)
Merge branch 'hwmon-for-linus' of git://github.com/groeck/linux
* 'hwmon-for-linus' of git://github.com/groeck/linux: hwmon: (coretemp) Avoid leaving around dangling pointer hwmon: (coretemp) Fixup platform device ID change
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/coretemp.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 44b23917d4c..93238378664 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -377,9 +377,9 @@ exit_free:
377} 377}
378 378
379 379
380static int __devinit chk_ucode_version(struct platform_device *pdev) 380static int __cpuinit chk_ucode_version(unsigned int cpu)
381{ 381{
382 struct cpuinfo_x86 *c = &cpu_data(pdev->id); 382 struct cpuinfo_x86 *c = &cpu_data(cpu);
383 int err; 383 int err;
384 u32 edx; 384 u32 edx;
385 385
@@ -390,17 +390,15 @@ static int __devinit chk_ucode_version(struct platform_device *pdev)
390 */ 390 */
391 if (c->x86_model == 0xe && c->x86_mask < 0xc) { 391 if (c->x86_model == 0xe && c->x86_mask < 0xc) {
392 /* check for microcode update */ 392 /* check for microcode update */
393 err = smp_call_function_single(pdev->id, get_ucode_rev_on_cpu, 393 err = smp_call_function_single(cpu, get_ucode_rev_on_cpu,
394 &edx, 1); 394 &edx, 1);
395 if (err) { 395 if (err) {
396 dev_err(&pdev->dev, 396 pr_err("Cannot determine microcode revision of "
397 "Cannot determine microcode revision of " 397 "CPU#%u (%d)!\n", cpu, err);
398 "CPU#%u (%d)!\n", pdev->id, err);
399 return -ENODEV; 398 return -ENODEV;
400 } else if (edx < 0x39) { 399 } else if (edx < 0x39) {
401 dev_err(&pdev->dev, 400 pr_err("Errata AE18 not fixed, update BIOS or "
402 "Errata AE18 not fixed, update BIOS or " 401 "microcode of the CPU!\n");
403 "microcode of the CPU!\n");
404 return -ENODEV; 402 return -ENODEV;
405 } 403 }
406 } 404 }
@@ -508,6 +506,7 @@ static int create_core_data(struct platform_device *pdev,
508 506
509 return 0; 507 return 0;
510exit_free: 508exit_free:
509 pdata->core_data[attr_no] = NULL;
511 kfree(tdata); 510 kfree(tdata);
512 return err; 511 return err;
513} 512}
@@ -544,11 +543,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
544 struct platform_data *pdata; 543 struct platform_data *pdata;
545 int err; 544 int err;
546 545
547 /* Check the microcode version of the CPU */
548 err = chk_ucode_version(pdev);
549 if (err)
550 return err;
551
552 /* Initialize the per-package data structures */ 546 /* Initialize the per-package data structures */
553 pdata = kzalloc(sizeof(struct platform_data), GFP_KERNEL); 547 pdata = kzalloc(sizeof(struct platform_data), GFP_KERNEL);
554 if (!pdata) 548 if (!pdata)
@@ -630,7 +624,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu)
630 } 624 }
631 625
632 pdev_entry->pdev = pdev; 626 pdev_entry->pdev = pdev;
633 pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); 627 pdev_entry->phys_proc_id = pdev->id;
634 628
635 list_add_tail(&pdev_entry->list, &pdev_list); 629 list_add_tail(&pdev_entry->list, &pdev_list);
636 mutex_unlock(&pdev_list_mutex); 630 mutex_unlock(&pdev_list_mutex);
@@ -691,6 +685,10 @@ static void __cpuinit get_core_online(unsigned int cpu)
691 return; 685 return;
692 686
693 if (!pdev) { 687 if (!pdev) {
688 /* Check the microcode version of the CPU */
689 if (chk_ucode_version(cpu))
690 return;
691
694 /* 692 /*
695 * Alright, we have DTS support. 693 * Alright, we have DTS support.
696 * We are bringing the _first_ core in this pkg 694 * We are bringing the _first_ core in this pkg