From f28bb45e2863173a7464d98907677e903f42c68b Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Fri, 15 Feb 2008 08:34:37 +0800 Subject: ACPI: thermal: Check whether cooling device exists before unregistering OS should check whether the cooling device exists before it is unregistered. If it doesn't exists, it is unnecessary to remove the sysfs link and call the function of thermal_cooling_device_unregister. http://bugzilla.kernel.org/show_bug.cgi?id=9982 Signed-off-by: Zhao Yakui Tested-by : Dhaval Giani Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/acpi/processor_core.c') diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 75ccf5d18bf..697335c8423 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -809,10 +809,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_processor_remove_fs(device); - sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); - sysfs_remove_link(&pr->cdev->device.kobj, "device"); - thermal_cooling_device_unregister(pr->cdev); - pr->cdev = NULL; + if (pr->cdev) { + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + sysfs_remove_link(&pr->cdev->device.kobj, "device"); + thermal_cooling_device_unregister(pr->cdev); + pr->cdev = NULL; + } processors[pr->id] = NULL; -- cgit v1.2.3 From d76628c67cdeebf84766a19c67c821c2e518baa4 Mon Sep 17 00:00:00 2001 From: Thomas Sujith Date: Fri, 15 Feb 2008 18:26:54 -0500 Subject: 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 Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'drivers/acpi/processor_core.c') diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 75ccf5d18bf..b02006951cd 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) pr->cdev = thermal_cooling_device_register("Processor", device, &processor_cooling_ops); - if (pr->cdev) + if (IS_ERR(pr->cdev)) { + result = PTR_ERR(pr->cdev); + goto end; + } + if (pr->cdev) { printk(KERN_INFO PREFIX "%s is registered as cooling_device%d\n", device->dev.bus_id, pr->cdev->id); - else - goto end; - result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj, - "thermal_cooling"); - if (result) - return result; - result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, - "device"); - if (result) - return result; + result = sysfs_create_link(&device->dev.kobj, + &pr->cdev->device.kobj, + "thermal_cooling"); + if (result) + return result; + result = sysfs_create_link(&pr->cdev->device.kobj, + &device->dev.kobj, + "device"); + if (result) + return result; + } if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", @@ -809,10 +814,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_processor_remove_fs(device); - sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); - sysfs_remove_link(&pr->cdev->device.kobj, "device"); - thermal_cooling_device_unregister(pr->cdev); - pr->cdev = NULL; + if (pr->cdev) { + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + sysfs_remove_link(&pr->cdev->device.kobj, "device"); + thermal_cooling_device_unregister(pr->cdev); + pr->cdev = NULL; + } processors[pr->id] = NULL; -- cgit v1.2.3 From e85ff4b53eb4252d967922bd75cb6d10863955f3 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Sat, 16 Feb 2008 01:01:13 -0500 Subject: ACPI: remove is_processor_present prototype The function itself is defined just below, so this prototype is not really useful. Signed-off-by: Glauber Costa Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/acpi/processor_core.c') diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 75ccf5d18bf..923fddb2caa 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -826,8 +826,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type) * Acpi processor hotplug support * ****************************************************************************/ -static int is_processor_present(acpi_handle handle); - static int is_processor_present(acpi_handle handle) { acpi_status status; -- cgit v1.2.3