Pull bugzilla-7887 into release branch
authorLen Brown <len.brown@intel.com>
Sat, 17 Feb 2007 03:11:57 +0000 (22:11 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 17 Feb 2007 03:11:57 +0000 (22:11 -0500)
1  2 
drivers/acpi/bus.c
include/acpi/acpi_drivers.h

diff --combined drivers/acpi/bus.c
index 0c93cd400ddb02254a268c3af5837a318ab65a4e,41cebe5bc8071382c7882b6d7820a1b7b450cda8..dd49ea0d0ed3606a69dfc2a9580b64768ced7cb9
@@@ -39,7 -39,7 +39,7 @@@
  #include <acpi/acpi_drivers.h>
  
  #define _COMPONENT            ACPI_BUS_COMPONENT
 -ACPI_MODULE_NAME("acpi_bus")
 +ACPI_MODULE_NAME("bus");
  #ifdef        CONFIG_X86
  extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
  #endif
@@@ -147,7 -147,7 +147,7 @@@ int acpi_bus_get_power(acpi_handle hand
                        *state = ACPI_STATE_D0;
        } else {
                /*
-                * Get the device's power state either directly (via _PSC) or 
+                * Get the device's power state either directly (via _PSC) or
                 * indirectly (via power resources).
                 */
                if (device->power.flags.explicit_get) {
@@@ -199,14 -199,15 +199,14 @@@ int acpi_bus_set_power(acpi_handle hand
         * Get device's current power state if it's unknown
         * This means device power state isn't initialized or previous setting failed
         */
 -      if (!device->flags.force_power_state) {
 -              if (device->power.state == ACPI_STATE_UNKNOWN)
 -                      acpi_bus_get_power(device->handle, &device->power.state);
 -              if (state == device->power.state) {
 -                      ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
 -                                        state));
 -                      return 0;
 -              }
 +      if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state)
 +              acpi_bus_get_power(device->handle, &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;
        }
 +
        if (!device->power.states[state].flags.valid) {
                printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
                return -ENODEV;
@@@ -461,7 -462,7 +461,7 @@@ static void acpi_bus_notify(acpi_handl
                                  "Received BUS CHECK notification for device [%s]\n",
                                  device->pnp.bus_id));
                result = acpi_bus_check_scope(device);
-               /* 
+               /*
                 * TBD: We'll need to outsource certain events to non-ACPI
                 *      drivers via the device manager (device.c).
                 */
                                  "Received DEVICE CHECK notification for device [%s]\n",
                                  device->pnp.bus_id));
                result = acpi_bus_check_device(device, NULL);
-               /* 
+               /*
                 * TBD: We'll need to outsource certain events to non-ACPI
                 *      drivers via the device manager (device.c).
                 */
@@@ -542,7 -543,7 +542,7 @@@ static int __init acpi_bus_init_irq(voi
        char *message = NULL;
  
  
-       /* 
+       /*
         * Let the system know what interrupt model we are using by
         * evaluating the \_PIC object, if exists.
         */
@@@ -683,7 -684,7 +683,7 @@@ static int __init acpi_bus_init(void
         * the EC device is found in the namespace (i.e. before acpi_initialize_objects()
         * is called).
         *
-        * This is accomplished by looking for the ECDT table, and getting 
+        * This is accomplished by looking for the ECDT table, and getting
         * the EC parameters out of that.
         */
        status = acpi_ec_ecdt_probe();
  
        printk(KERN_INFO PREFIX "Interpreter enabled\n");
  
+       /* Initialize sleep structures */
+       acpi_sleep_init();
        /*
         * Get the system interrupt model and evaluate \_PIC.
         */
index 07a5eb036e96a01967c1d5264b2c5cceffe24373,ce0e62fb28c16084e00806b4b8b327b7ab37eddf..f6275b0e66dd34bbd5e3fde2be186eeda43ebba4
@@@ -105,6 -105,12 +105,6 @@@ int acpi_ec_ecdt_probe(void)
  
  int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
  
 -/* --------------------------------------------------------------------------
 -                                    Hot Keys
 -   -------------------------------------------------------------------------- */
 -
 -extern int acpi_specific_hotkey_enabled;
 -
  /*--------------------------------------------------------------------------
                                    Dock Station
    -------------------------------------------------------------------------- */
@@@ -116,24 -122,20 +116,34 @@@ extern int register_hotplug_dock_device
        acpi_notify_handler handler, void *context);
  extern void unregister_hotplug_dock_device(acpi_handle handle);
  #else
 -#define is_dock_device(h)                     (0)
 -#define register_dock_notifier(nb)            (-ENODEV)
 -#define unregister_dock_notifier(nb)                  do { } while(0)
 -#define register_hotplug_dock_device(h1, h2, c)       (-ENODEV)
 -#define unregister_hotplug_dock_device(h)       do { } while(0)
 +static inline int is_dock_device(acpi_handle handle)
 +{
 +      return 0;
 +}
 +static inline int register_dock_notifier(struct notifier_block *nb)
 +{
 +      return -ENODEV;
 +}
 +static inline void unregister_dock_notifier(struct notifier_block *nb)
 +{
 +}
 +static inline int register_hotplug_dock_device(acpi_handle handle,
 +                              acpi_notify_handler handler, void *context)
 +{
 +      return -ENODEV;
 +}
 +static inline void unregister_hotplug_dock_device(acpi_handle handle)
 +{
 +}
  #endif
+ /*--------------------------------------------------------------------------
+                                   Suspend/Resume
+   -------------------------------------------------------------------------- */
+ #ifdef CONFIG_ACPI_SLEEP
+ extern int acpi_sleep_init(void);
+ #else
+ #define acpi_sleep_init() do {} while (0)
+ #endif
  #endif /*__ACPI_DRIVERS_H__*/