]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/bus.c
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-2.6-omap-h63xx.git] / drivers / acpi / bus.c
index 49d432d0a12c6d7682b5325015f6612124058d19..8b0d4b7d188a4b2cae701f50459cd80f39fd4a63 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/list.h>
 #include <linux/sched.h>
 #include <linux/pm.h>
-#include <linux/pm_legacy.h>
 #include <linux/device.h>
 #include <linux/proc_fs.h>
 #ifdef CONFIG_X86
@@ -123,6 +122,31 @@ int acpi_bus_get_status(struct acpi_device *device)
 
 EXPORT_SYMBOL(acpi_bus_get_status);
 
+void acpi_bus_private_data_handler(acpi_handle handle,
+                                  u32 function, void *context)
+{
+       return;
+}
+EXPORT_SYMBOL(acpi_bus_private_data_handler);
+
+int acpi_bus_get_private_data(acpi_handle handle, void **data)
+{
+       acpi_status status = AE_OK;
+
+       if (!*data)
+               return -EINVAL;
+
+       status = acpi_get_data(handle, acpi_bus_private_data_handler, data);
+       if (ACPI_FAILURE(status) || !*data) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
+                               handle));
+               return -ENODEV;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(acpi_bus_get_private_data);
+
 /* --------------------------------------------------------------------------
                                  Power Management
    -------------------------------------------------------------------------- */
@@ -201,7 +225,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
         * Get device's current power state
         */
        acpi_bus_get_power(device->handle, &device->power.state);
-       if (state == device->power.state) {
+       if ((state == device->power.state) && !device->flags.force_power_state) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
                                  state));
                return 0;
@@ -367,7 +391,6 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
        return 0;
 }
 
-EXPORT_SYMBOL(acpi_bus_receive_event);
 #endif /* CONFIG_ACPI_PROC_EVENT */
 
 /* --------------------------------------------------------------------------
@@ -744,7 +767,7 @@ static int __init acpi_bus_init(void)
        return -ENODEV;
 }
 
-decl_subsys(acpi, NULL, NULL);
+struct kobject *acpi_kobj;
 
 static int __init acpi_init(void)
 {
@@ -756,24 +779,23 @@ static int __init acpi_init(void)
                return -ENODEV;
        }
 
-       result = firmware_register(&acpi_subsys);
-       if (result < 0)
-               printk(KERN_WARNING "%s: firmware_register error: %d\n",
-                       __FUNCTION__, result);
+       acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
+       if (!acpi_kobj) {
+               printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__);
+               acpi_kobj = NULL;
+       }
 
        result = acpi_bus_init();
 
        if (!result) {
-#ifdef CONFIG_PM_LEGACY
-               if (!PM_IS_ACTIVE())
-                       pm_active = 1;
+               if (!(pm_flags & PM_APM))
+                       pm_flags |= PM_ACPI;
                else {
                        printk(KERN_INFO PREFIX
                               "APM is already active, exiting\n");
                        disable_acpi();
                        result = -ENODEV;
                }
-#endif
        } else
                disable_acpi();