]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/thermal.c
ACPI: add newline to printk
[linux-2.6-omap-h63xx.git] / drivers / acpi / thermal.c
index aee371f9daf82e92fb0ff06f1b9256b04fab1458..8d4b79b4f933c631281e23ce8b602e3bcbbf3d9f 100644 (file)
@@ -539,7 +539,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 
 static int acpi_thermal_critical(struct acpi_thermal *tz)
 {
-       if (!tz || !tz->trips.critical.flags.valid || nocrt)
+       if (!tz || !tz->trips.critical.flags.valid)
                return -EINVAL;
 
        if (tz->temperature >= tz->trips.critical.temperature) {
@@ -548,9 +548,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
        } else if (tz->trips.critical.flags.enabled)
                tz->trips.critical.flags.enabled = 0;
 
-       printk(KERN_EMERG
-              "Critical temperature reached (%ld C), shutting down.\n",
-              KELVIN_TO_CELSIUS(tz->temperature));
        acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
                                tz->trips.critical.flags.enabled);
        acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
@@ -558,14 +555,20 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
                                          ACPI_THERMAL_NOTIFY_CRITICAL,
                                          tz->trips.critical.flags.enabled);
 
-       orderly_poweroff(true);
+       /* take no action if nocrt is set */
+       if(!nocrt) {
+               printk(KERN_EMERG
+                       "Critical temperature reached (%ld C), shutting down.\n",
+                       KELVIN_TO_CELSIUS(tz->temperature));
+               orderly_poweroff(true);
+       }
 
        return 0;
 }
 
 static int acpi_thermal_hot(struct acpi_thermal *tz)
 {
-       if (!tz || !tz->trips.hot.flags.valid || nocrt)
+       if (!tz || !tz->trips.hot.flags.valid)
                return -EINVAL;
 
        if (tz->temperature >= tz->trips.hot.temperature) {
@@ -581,7 +584,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
                                          ACPI_THERMAL_NOTIFY_HOT,
                                          tz->trips.hot.flags.enabled);
 
-       /* TBD: Call user-mode "sleep(S4)" function */
+       /* TBD: Call user-mode "sleep(S4)" function if nocrt is cleared */
 
        return 0;
 }
@@ -1015,7 +1018,9 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
 {
        struct acpi_device *device = cdev->devdata;
        struct acpi_thermal *tz = thermal->devdata;
-       acpi_handle handle = device->handle;
+       struct acpi_device *dev;
+       acpi_status status;
+       acpi_handle handle;
        int i;
        int j;
        int trip = -1;
@@ -1031,12 +1036,13 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
                trip++;
                for (i = 0; i < tz->trips.passive.devices.count;
                    i++) {
-                       if (tz->trips.passive.devices.handles[i] !=
-                               handle)
-                               continue;
-                       result = action(thermal, trip, cdev);
-                       if (result)
-                               goto failed;
+                       handle = tz->trips.passive.devices.handles[i];
+                       status = acpi_bus_get_device(handle, &dev);
+                       if (ACPI_SUCCESS(status) && (dev == device)) {
+                               result = action(thermal, trip, cdev);
+                               if (result)
+                                       goto failed;
+                       }
                }
        }
 
@@ -1047,21 +1053,24 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
                for (j = 0;
                    j < tz->trips.active[i].devices.count;
                    j++) {
-                       if (tz->trips.active[i].devices.
-                                               handles[j] != handle)
-                               continue;
-                       result = action(thermal, trip, cdev);
-                       if (result)
-                               goto failed;
+                       handle = tz->trips.active[i].devices.handles[j];
+                       status = acpi_bus_get_device(handle, &dev);
+                       if (ACPI_SUCCESS(status) && (dev == device)) {
+                               result = action(thermal, trip, cdev);
+                               if (result)
+                                       goto failed;
+                       }
                }
        }
 
        for (i = 0; i < tz->devices.count; i++) {
-               if (tz->devices.handles[i] != handle)
-                       continue;
-               result = action(thermal, -1, cdev);
-               if (result)
-                       goto failed;
+               handle = tz->devices.handles[i];
+               status = acpi_bus_get_device(handle, &dev);
+               if (ACPI_SUCCESS(status) && (dev == device)) {
+                       result = action(thermal, -1, cdev);
+                       if (result)
+                               goto failed;
+               }
        }
 
 failed: