linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/6] ACPI fan: extract return values using PTR_ERR
@ 2008-02-15  5:23 Thomas, Sujith
  0 siblings, 0 replies; only message in thread
From: Thomas, Sujith @ 2008-02-15  5:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-acpi, linux-pm, mingo

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

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>
---

 drivers/acpi/fan.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

Index: linux-2.6.24/drivers/acpi/fan.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/fan.c
+++ linux-2.6.24/drivers/acpi/fan.c
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_devi
 
 	cdev = thermal_cooling_device_register("Fan", device,
 						&fan_cooling_ops);
-	if (cdev)
+	if (IS_ERR(cdev)) {
+		result = PTR_ERR(cdev);
+		goto end;
+	}
+	if (cdev) {
 		printk(KERN_INFO PREFIX
 			"%s is registered as cooling_device%d\n",
 			device->dev.bus_id, cdev->id);
-	else
-		goto end;
-	acpi_driver_data(device) = cdev;
-	result = sysfs_create_link(&device->dev.kobj,
&cdev->device.kobj,
-					"thermal_cooling");
-	if (result)
-		return result;
 
-	result = sysfs_create_link(&cdev->device.kobj,
&device->dev.kobj,
-                                       "device");
-        if (result)
-                return result;
+		acpi_driver_data(device) = cdev;
+		result = sysfs_create_link(&device->dev.kobj,
+					   &cdev->device.kobj,
+					   "thermal_cooling");
+		if (result)
+			return result;
+
+		result = sysfs_create_link(&cdev->device.kobj,
+					   &device->dev.kobj,
+					   "device");
+		if (result)
+			return result;
+	}
 
 	result = acpi_fan_add_fs(device);
 	if (result)

[-- Attachment #2: [patch 3 of 6] ACPI fan - extract return value using PTR_ERR --]
[-- Type: application/octet-stream, Size: 1665 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

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>
---

 drivers/acpi/fan.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

Index: linux-2.6.24/drivers/acpi/fan.c
===================================================================
--- linux-2.6.24.orig/drivers/acpi/fan.c
+++ linux-2.6.24/drivers/acpi/fan.c
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_devi
 
 	cdev = thermal_cooling_device_register("Fan", device,
 						&fan_cooling_ops);
-	if (cdev)
+	if (IS_ERR(cdev)) {
+		result = PTR_ERR(cdev);
+		goto end;
+	}
+	if (cdev) {
 		printk(KERN_INFO PREFIX
 			"%s is registered as cooling_device%d\n",
 			device->dev.bus_id, cdev->id);
-	else
-		goto end;
-	acpi_driver_data(device) = cdev;
-	result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj,
-					"thermal_cooling");
-	if (result)
-		return result;
 
-	result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj,
-                                       "device");
-        if (result)
-                return result;
+		acpi_driver_data(device) = cdev;
+		result = sysfs_create_link(&device->dev.kobj,
+					   &cdev->device.kobj,
+					   "thermal_cooling");
+		if (result)
+			return result;
+
+		result = sysfs_create_link(&cdev->device.kobj,
+					   &device->dev.kobj,
+					   "device");
+		if (result)
+			return result;
+	}
 
 	result = acpi_fan_add_fs(device);
 	if (result)

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-15  5:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15  5:23 [patch 3/6] ACPI fan: extract return values using PTR_ERR Thomas, Sujith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).