aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorThomas Sujith <sujith.thomas@intel.com>2008-02-15 18:26:54 -0500
committerLen Brown <len.brown@intel.com>2008-02-15 18:26:54 -0500
commitd76628c67cdeebf84766a19c67c821c2e518baa4 (patch)
tree57d6af9424a3ea07914317821d9a8a2c7505368f /drivers/acpi
parent19b36780ee7ddeb5080e3f1f858a83c4824f1fdc (diff)
ACPI thermal: extract return values using PTR_ERR
Need to extract errors using PTR_ERR macro and process accordingly.thermal_cooling_device_register returning NULL means that CONFIG_THERMAL=n and in that case no need to create symbolic links. Signed-off-by: Thomas Sujith <sujith.thomas@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_core.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 75ccf5d18bf4..b02006951cd0 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
670 670
671 pr->cdev = thermal_cooling_device_register("Processor", device, 671 pr->cdev = thermal_cooling_device_register("Processor", device,
672 &processor_cooling_ops); 672 &processor_cooling_ops);
673 if (pr->cdev) 673 if (IS_ERR(pr->cdev)) {
674 result = PTR_ERR(pr->cdev);
675 goto end;
676 }
677 if (pr->cdev) {
674 printk(KERN_INFO PREFIX 678 printk(KERN_INFO PREFIX
675 "%s is registered as cooling_device%d\n", 679 "%s is registered as cooling_device%d\n",
676 device->dev.bus_id, pr->cdev->id); 680 device->dev.bus_id, pr->cdev->id);
677 else
678 goto end;
679 681
680 result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj, 682 result = sysfs_create_link(&device->dev.kobj,
681 "thermal_cooling"); 683 &pr->cdev->device.kobj,
682 if (result) 684 "thermal_cooling");
683 return result; 685 if (result)
684 result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, 686 return result;
685 "device"); 687 result = sysfs_create_link(&pr->cdev->device.kobj,
686 if (result) 688 &device->dev.kobj,
687 return result; 689 "device");
690 if (result)
691 return result;
692 }
688 693
689 if (pr->flags.throttling) { 694 if (pr->flags.throttling) {
690 printk(KERN_INFO PREFIX "%s [%s] (supports", 695 printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -809,10 +814,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
809 814
810 acpi_processor_remove_fs(device); 815 acpi_processor_remove_fs(device);
811 816
812 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 817 if (pr->cdev) {
813 sysfs_remove_link(&pr->cdev->device.kobj, "device"); 818 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
814 thermal_cooling_device_unregister(pr->cdev); 819 sysfs_remove_link(&pr->cdev->device.kobj, "device");
815 pr->cdev = NULL; 820 thermal_cooling_device_unregister(pr->cdev);
821 pr->cdev = NULL;
822 }
816 823
817 processors[pr->id] = NULL; 824 processors[pr->id] = NULL;
818 825