]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/acpi/thermal.c
ACPI: EC: add another DMI check for ASUS hardware
[linux-2.6.git] / drivers / acpi / thermal.c
index 0ec48d2f85c54689c6bc7237616571b441911f6e..2607e17b520f9b39a5d60f7bee508ba62b813ea0 100644 (file)
 #include <linux/module.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/proc_fs.h>
 #include <linux/jiffies.h>
 #include <linux/kmod.h>
-#include <linux/seq_file.h>
 #include <linux/reboot.h>
+#include <linux/device.h>
 #include <asm/uaccess.h>
 #include <linux/thermal.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
+#define PREFIX "ACPI: "
+
 #define ACPI_THERMAL_CLASS             "thermal_zone"
 #define ACPI_THERMAL_DEVICE_NAME       "Thermal Zone"
 #define ACPI_THERMAL_FILE_STATE                "state"
@@ -97,16 +99,7 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
-static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
-static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
-static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
-static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_cooling_mode(struct file *,
-                                              const char __user *, size_t,
-                                              loff_t *);
-static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_polling(struct file *, const char __user *,
-                                         size_t, loff_t *);
+static void acpi_thermal_notify(struct acpi_device *device, u32 event);
 
 static const struct acpi_device_id  thermal_device_ids[] = {
        {ACPI_THERMAL_HID, 0},
@@ -122,6 +115,7 @@ static struct acpi_driver acpi_thermal_driver = {
                .add = acpi_thermal_add,
                .remove = acpi_thermal_remove,
                .resume = acpi_thermal_resume,
+               .notify = acpi_thermal_notify,
                },
 };
 
@@ -191,51 +185,10 @@ struct acpi_thermal {
        struct acpi_handle_list devices;
        struct thermal_zone_device *thermal_zone;
        int tz_enabled;
+       int kelvin_offset;
        struct mutex lock;
 };
 
-static const struct file_operations acpi_thermal_state_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_thermal_state_open_fs,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static const struct file_operations acpi_thermal_temp_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_thermal_temp_open_fs,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static const struct file_operations acpi_thermal_trip_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_thermal_trip_open_fs,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static const struct file_operations acpi_thermal_cooling_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_thermal_cooling_open_fs,
-       .read = seq_read,
-       .write = acpi_thermal_write_cooling_mode,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static const struct file_operations acpi_thermal_polling_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_thermal_polling_open_fs,
-       .read = seq_read,
-       .write = acpi_thermal_write_polling,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
 /* --------------------------------------------------------------------------
                              Thermal Zone Management
    -------------------------------------------------------------------------- */
@@ -280,26 +233,6 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
        return 0;
 }
 
-static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
-{
-
-       if (!tz)
-               return -EINVAL;
-
-       tz->polling_frequency = seconds * 10;   /* Convert value to deci-seconds */
-
-       tz->thermal_zone->polling_delay = seconds * 1000;
-
-       if (tz->tz_enabled)
-               thermal_zone_device_update(tz->thermal_zone);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "Polling frequency set to %lu seconds\n",
-                         tz->polling_frequency/10));
-
-       return 0;
-}
-
 static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
 {
        acpi_status status = AE_OK;
@@ -362,7 +295,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
        int valid = 0;
        int i;
 
-       /* Critical Shutdown (required) */
+       /* Critical Shutdown */
        if (flag & ACPI_TRIPS_CRITICAL) {
                status = acpi_evaluate_integer(tz->device->handle,
                                "_CRT", NULL, &tmp);
@@ -370,20 +303,22 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                /*
                 * Treat freezing temperatures as invalid as well; some
                 * BIOSes return really low values and cause reboots at startup.
-                * Below zero (Celcius) values clearly aren't right for sure..
+                * Below zero (Celsius) values clearly aren't right for sure..
                 * ... so lets discard those as invalid.
                 */
-               if (ACPI_FAILURE(status) ||
-                               tz->trips.critical.temperature <= 2732) {
+               if (ACPI_FAILURE(status)) {
+                       tz->trips.critical.flags.valid = 0;
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "No critical threshold\n"));
+               } else if (tmp <= 2732) {
+                       printk(KERN_WARNING FW_BUG "Invalid critical threshold "
+                              "(%llu)\n", tmp);
                        tz->trips.critical.flags.valid = 0;
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "No or invalid critical threshold"));
-                       return -ENODEV;
                } else {
                        tz->trips.critical.flags.valid = 1;
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "Found critical threshold [%lu]\n",
-                                       tz->trips.critical.temperature));
+                                         "Found critical threshold [%lu]\n",
+                                         tz->trips.critical.temperature));
                }
                if (tz->trips.critical.flags.valid == 1) {
                        if (crt == -1) {
@@ -569,7 +504,23 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 
 static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 {
-       return acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+       int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+
+       if (ret)
+               return ret;
+
+       valid = tz->trips.critical.flags.valid |
+               tz->trips.hot.flags.valid |
+               tz->trips.passive.flags.valid;
+
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
+               valid |= tz->trips.active[i].flags.valid;
+
+       if (!valid) {
+               printk(KERN_WARNING FW_BUG "No valid trip found\n");
+               return -ENODEV;
+       }
+       return 0;
 }
 
 static void acpi_thermal_check(void *data)
@@ -580,7 +531,7 @@ static void acpi_thermal_check(void *data)
 }
 
 /* sys I/F for generic thermal sysfs support */
-#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200)
+#define KELVIN_TO_MILLICELSIUS(t, off) (((t) - (off)) * 100)
 
 static int thermal_get_temp(struct thermal_zone_device *thermal,
                            unsigned long *temp)
@@ -595,7 +546,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal,
        if (result)
                return result;
 
-       *temp = KELVIN_TO_MILLICELSIUS(tz->temperature);
+       *temp = KELVIN_TO_MILLICELSIUS(tz->temperature, tz->kelvin_offset);
        return 0;
 }
 
@@ -701,7 +652,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
        if (tz->trips.critical.flags.valid) {
                if (!trip) {
                        *temp = KELVIN_TO_MILLICELSIUS(
-                               tz->trips.critical.temperature);
+                               tz->trips.critical.temperature,
+                               tz->kelvin_offset);
                        return 0;
                }
                trip--;
@@ -710,7 +662,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
        if (tz->trips.hot.flags.valid) {
                if (!trip) {
                        *temp = KELVIN_TO_MILLICELSIUS(
-                               tz->trips.hot.temperature);
+                               tz->trips.hot.temperature,
+                               tz->kelvin_offset);
                        return 0;
                }
                trip--;
@@ -719,7 +672,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
        if (tz->trips.passive.flags.valid) {
                if (!trip) {
                        *temp = KELVIN_TO_MILLICELSIUS(
-                               tz->trips.passive.temperature);
+                               tz->trips.passive.temperature,
+                               tz->kelvin_offset);
                        return 0;
                }
                trip--;
@@ -729,7 +683,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
                tz->trips.active[i].flags.valid; i++) {
                if (!trip) {
                        *temp = KELVIN_TO_MILLICELSIUS(
-                               tz->trips.active[i].temperature);
+                               tz->trips.active[i].temperature,
+                               tz->kelvin_offset);
                        return 0;
                }
                trip--;
@@ -744,7 +699,8 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
 
        if (tz->trips.critical.flags.valid) {
                *temperature = KELVIN_TO_MILLICELSIUS(
-                               tz->trips.critical.temperature);
+                               tz->trips.critical.temperature,
+                               tz->kelvin_offset);
                return 0;
        } else
                return -EINVAL;
@@ -765,7 +721,7 @@ static int thermal_notify(struct thermal_zone_device *thermal, int trip,
 
        acpi_bus_generate_proc_event(tz->device, type, 1);
        acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
-                                       tz->device->dev.bus_id, type, 1);
+                                       dev_name(&tz->device->dev), type, 1);
 
        if (trip_type == THERMAL_TRIP_CRITICAL && nocrt)
                return 1;
@@ -900,7 +856,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
                        thermal_zone_device_register("acpitz", trips, tz,
                                                     &acpi_thermal_zone_ops,
                                                     0, 0, 0,
-                                                    tz->polling_frequency);
+                                                    tz->polling_frequency*100);
        if (IS_ERR(tz->thermal_zone))
                return -ENODEV;
 
@@ -940,341 +896,18 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
 }
 
 
-/* --------------------------------------------------------------------------
-                              FS Interface (/proc)
-   -------------------------------------------------------------------------- */
-
-static struct proc_dir_entry *acpi_thermal_dir;
-
-static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_thermal *tz = seq->private;
-
-
-       if (!tz)
-               goto end;
-
-       seq_puts(seq, "state:                   ");
-
-       if (!tz->state.critical && !tz->state.hot && !tz->state.passive
-           && !tz->state.active)
-               seq_puts(seq, "ok\n");
-       else {
-               if (tz->state.critical)
-                       seq_puts(seq, "critical ");
-               if (tz->state.hot)
-                       seq_puts(seq, "hot ");
-               if (tz->state.passive)
-                       seq_puts(seq, "passive ");
-               if (tz->state.active)
-                       seq_printf(seq, "active[%d]", tz->state.active_index);
-               seq_puts(seq, "\n");
-       }
-
-      end:
-       return 0;
-}
-
-static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data);
-}
-
-static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
-{
-       int result = 0;
-       struct acpi_thermal *tz = seq->private;
-
-
-       if (!tz)
-               goto end;
-
-       result = acpi_thermal_get_temperature(tz);
-       if (result)
-               goto end;
-
-       seq_printf(seq, "temperature:             %ld C\n",
-                  KELVIN_TO_CELSIUS(tz->temperature));
-
-      end:
-       return 0;
-}
-
-static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data);
-}
-
-static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_thermal *tz = seq->private;
-       struct acpi_device *device;
-       acpi_status status;
-
-       int i = 0;
-       int j = 0;
-
-
-       if (!tz)
-               goto end;
-
-       if (tz->trips.critical.flags.valid)
-               seq_printf(seq, "critical (S5):           %ld C%s",
-                          KELVIN_TO_CELSIUS(tz->trips.critical.temperature),
-                          nocrt ? " <disabled>\n" : "\n");
-
-       if (tz->trips.hot.flags.valid)
-               seq_printf(seq, "hot (S4):                %ld C%s",
-                          KELVIN_TO_CELSIUS(tz->trips.hot.temperature),
-                          nocrt ? " <disabled>\n" : "\n");
-
-       if (tz->trips.passive.flags.valid) {
-               seq_printf(seq,
-                          "passive:                 %ld C: tc1=%lu tc2=%lu tsp=%lu devices=",
-                          KELVIN_TO_CELSIUS(tz->trips.passive.temperature),
-                          tz->trips.passive.tc1, tz->trips.passive.tc2,
-                          tz->trips.passive.tsp);
-               for (j = 0; j < tz->trips.passive.devices.count; j++) {
-                       status = acpi_bus_get_device(tz->trips.passive.devices.
-                                                    handles[j], &device);
-                       seq_printf(seq, "%4.4s ", status ? "" :
-                                  acpi_device_bid(device));
-               }
-               seq_puts(seq, "\n");
-       }
-
-       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
-               if (!(tz->trips.active[i].flags.valid))
-                       break;
-               seq_printf(seq, "active[%d]:               %ld C: devices=",
-                          i,
-                          KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
-               for (j = 0; j < tz->trips.active[i].devices.count; j++){
-                       status = acpi_bus_get_device(tz->trips.active[i].
-                                                    devices.handles[j],
-                                                    &device);
-                       seq_printf(seq, "%4.4s ", status ? "" :
-                                  acpi_device_bid(device));
-               }
-               seq_puts(seq, "\n");
-       }
-
-      end:
-       return 0;
-}
-
-static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data);
-}
-
-static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_thermal *tz = seq->private;
-
-
-       if (!tz)
-               goto end;
-
-       if (!tz->flags.cooling_mode)
-               seq_puts(seq, "<setting not supported>\n");
-       else
-               seq_puts(seq, "0 - Active; 1 - Passive\n");
-
-      end:
-       return 0;
-}
-
-static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_thermal_cooling_seq_show,
-                          PDE(inode)->data);
-}
-
-static ssize_t
-acpi_thermal_write_cooling_mode(struct file *file,
-                               const char __user * buffer,
-                               size_t count, loff_t * ppos)
-{
-       struct seq_file *m = file->private_data;
-       struct acpi_thermal *tz = m->private;
-       int result = 0;
-       char mode_string[12] = { '\0' };
-
-
-       if (!tz || (count > sizeof(mode_string) - 1))
-               return -EINVAL;
-
-       if (!tz->flags.cooling_mode)
-               return -ENODEV;
-
-       if (copy_from_user(mode_string, buffer, count))
-               return -EFAULT;
-
-       mode_string[count] = '\0';
-
-       result = acpi_thermal_set_cooling_mode(tz,
-                                              simple_strtoul(mode_string, NULL,
-                                                             0));
-       if (result)
-               return result;
-
-       acpi_thermal_check(tz);
-
-       return count;
-}
-
-static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_thermal *tz = seq->private;
-
-
-       if (!tz)
-               goto end;
-
-       if (!tz->thermal_zone->polling_delay) {
-               seq_puts(seq, "<polling disabled>\n");
-               goto end;
-       }
-
-       seq_printf(seq, "polling frequency:       %d seconds\n",
-                  (tz->thermal_zone->polling_delay / 1000));
-
-      end:
-       return 0;
-}
-
-static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_thermal_polling_seq_show,
-                          PDE(inode)->data);
-}
-
-static ssize_t
-acpi_thermal_write_polling(struct file *file,
-                          const char __user * buffer,
-                          size_t count, loff_t * ppos)
-{
-       struct seq_file *m = file->private_data;
-       struct acpi_thermal *tz = m->private;
-       int result = 0;
-       char polling_string[12] = { '\0' };
-       int seconds = 0;
-
-
-       if (!tz || (count > sizeof(polling_string) - 1))
-               return -EINVAL;
-
-       if (copy_from_user(polling_string, buffer, count))
-               return -EFAULT;
-
-       polling_string[count] = '\0';
-
-       seconds = simple_strtoul(polling_string, NULL, 0);
-
-       result = acpi_thermal_set_polling(tz, seconds);
-       if (result)
-               return result;
-
-       acpi_thermal_check(tz);
-
-       return count;
-}
-
-static int acpi_thermal_add_fs(struct acpi_device *device)
-{
-       struct proc_dir_entry *entry = NULL;
-
-
-       if (!acpi_device_dir(device)) {
-               acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                                                    acpi_thermal_dir);
-               if (!acpi_device_dir(device))
-                       return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
-       }
-
-       /* 'state' [R] */
-       entry = proc_create_data(ACPI_THERMAL_FILE_STATE,
-                                S_IRUGO, acpi_device_dir(device),
-                                &acpi_thermal_state_fops,
-                                acpi_driver_data(device));
-       if (!entry)
-               return -ENODEV;
-
-       /* 'temperature' [R] */
-       entry = proc_create_data(ACPI_THERMAL_FILE_TEMPERATURE,
-                                S_IRUGO, acpi_device_dir(device),
-                                &acpi_thermal_temp_fops,
-                                acpi_driver_data(device));
-       if (!entry)
-               return -ENODEV;
-
-       /* 'trip_points' [R] */
-       entry = proc_create_data(ACPI_THERMAL_FILE_TRIP_POINTS,
-                                S_IRUGO,
-                                acpi_device_dir(device),
-                                &acpi_thermal_trip_fops,
-                                acpi_driver_data(device));
-       if (!entry)
-               return -ENODEV;
-
-       /* 'cooling_mode' [R/W] */
-       entry = proc_create_data(ACPI_THERMAL_FILE_COOLING_MODE,
-                                S_IFREG | S_IRUGO | S_IWUSR,
-                                acpi_device_dir(device),
-                                &acpi_thermal_cooling_fops,
-                                acpi_driver_data(device));
-       if (!entry)
-               return -ENODEV;
-
-       /* 'polling_frequency' [R/W] */
-       entry = proc_create_data(ACPI_THERMAL_FILE_POLLING_FREQ,
-                                S_IFREG | S_IRUGO | S_IWUSR,
-                                acpi_device_dir(device),
-                                &acpi_thermal_polling_fops,
-                                acpi_driver_data(device));
-       if (!entry)
-               return -ENODEV;
-       return 0;
-}
-
-static int acpi_thermal_remove_fs(struct acpi_device *device)
-{
-
-       if (acpi_device_dir(device)) {
-               remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
-                                 acpi_device_dir(device));
-               remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
-                                 acpi_device_dir(device));
-               remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
-                                 acpi_device_dir(device));
-               remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
-                                 acpi_device_dir(device));
-               remove_proc_entry(ACPI_THERMAL_FILE_STATE,
-                                 acpi_device_dir(device));
-               remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
-               acpi_device_dir(device) = NULL;
-       }
-
-       return 0;
-}
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
+static void acpi_thermal_notify(struct acpi_device *device, u32 event)
 {
-       struct acpi_thermal *tz = data;
-       struct acpi_device *device = NULL;
+       struct acpi_thermal *tz = acpi_driver_data(device);
 
 
        if (!tz)
                return;
 
-       device = tz->device;
-
        switch (event) {
        case ACPI_THERMAL_NOTIFY_TEMPERATURE:
                acpi_thermal_check(tz);
@@ -1298,8 +931,6 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
                                  "Unsupported event [0x%x]\n", event));
                break;
        }
-
-       return;
 }
 
 static int acpi_thermal_get_info(struct acpi_thermal *tz)
@@ -1334,10 +965,28 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
        return 0;
 }
 
+/*
+ * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
+ * handles temperature values with a single decimal place. As a consequence,
+ * some implementations use an offset of 273.1 and others use an offset of
+ * 273.2. Try to find out which one is being used, to present the most
+ * accurate and visually appealing number.
+ *
+ * The heuristic below should work for all ACPI thermal zones which have a
+ * critical trip point with a value being a multiple of 0.5 degree Celsius.
+ */
+static void acpi_thermal_guess_offset(struct acpi_thermal *tz)
+{
+       if (tz->trips.critical.flags.valid &&
+           (tz->trips.critical.temperature % 5) == 1)
+               tz->kelvin_offset = 2731;
+       else
+               tz->kelvin_offset = 2732;
+}
+
 static int acpi_thermal_add(struct acpi_device *device)
 {
        int result = 0;
-       acpi_status status = AE_OK;
        struct acpi_thermal *tz = NULL;
 
 
@@ -1360,31 +1009,17 @@ static int acpi_thermal_add(struct acpi_device *device)
        if (result)
                goto free_memory;
 
+       acpi_thermal_guess_offset(tz);
+
        result = acpi_thermal_register_thermal_zone(tz);
        if (result)
                goto free_memory;
 
-       result = acpi_thermal_add_fs(device);
-       if (result)
-               goto unregister_thermal_zone;
-
-       status = acpi_install_notify_handler(device->handle,
-                                            ACPI_DEVICE_NOTIFY,
-                                            acpi_thermal_notify, tz);
-       if (ACPI_FAILURE(status)) {
-               result = -ENODEV;
-               goto remove_fs;
-       }
-
        printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n",
               acpi_device_name(device), acpi_device_bid(device),
               KELVIN_TO_CELSIUS(tz->temperature));
        goto end;
 
-remove_fs:
-       acpi_thermal_remove_fs(device);
-unregister_thermal_zone:
-       thermal_zone_device_unregister(tz->thermal_zone);
 free_memory:
        kfree(tz);
 end:
@@ -1393,7 +1028,6 @@ end:
 
 static int acpi_thermal_remove(struct acpi_device *device, int type)
 {
-       acpi_status status = AE_OK;
        struct acpi_thermal *tz = NULL;
 
        if (!device || !acpi_driver_data(device))
@@ -1401,11 +1035,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
 
        tz = acpi_driver_data(device);
 
-       status = acpi_remove_notify_handler(device->handle,
-                                           ACPI_DEVICE_NOTIFY,
-                                           acpi_thermal_notify);
-
-       acpi_thermal_remove_fs(device);
        acpi_thermal_unregister_thermal_zone(tz);
        mutex_destroy(&tz->lock);
        kfree(tz);
@@ -1430,8 +1059,9 @@ static int acpi_thermal_resume(struct acpi_device *device)
                        break;
                tz->trips.active[i].flags.enabled = 1;
                for (j = 0; j < tz->trips.active[i].devices.count; j++) {
-                       result = acpi_bus_get_power(tz->trips.active[i].devices.
-                           handles[j], &power_state);
+                       result = acpi_bus_update_power(
+                                       tz->trips.active[i].devices.handles[j],
+                                       &power_state);
                        if (result || (power_state != ACPI_STATE_D0)) {
                                tz->trips.active[i].flags.enabled = 0;
                                break;
@@ -1530,16 +1160,10 @@ static int __init acpi_thermal_init(void)
                printk(KERN_NOTICE "ACPI: thermal control disabled\n");
                return -ENODEV;
        }
-       acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
-       if (!acpi_thermal_dir)
-               return -ENODEV;
-       acpi_thermal_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&acpi_thermal_driver);
-       if (result < 0) {
-               remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
+       if (result < 0)
                return -ENODEV;
-       }
 
        return 0;
 }
@@ -1549,8 +1173,6 @@ static void __exit acpi_thermal_exit(void)
 
        acpi_bus_unregister_driver(&acpi_thermal_driver);
 
-       remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
-
        return;
 }