memcgroup: implement failcounter reset
[safe/jmp/linux-2.6] / include / linux / pm.h
index 09a309b..1de72cb 100644 (file)
@@ -95,7 +95,7 @@ struct pm_dev
 };
 
 /* Functions above this comment are list-based old-style power
- * managment. Please avoid using them.  */
+ * management. Please avoid using them.  */
 
 /*
  * Callbacks for platform drivers to implement.
@@ -143,6 +143,9 @@ typedef struct pm_message {
  *             the upcoming system state (such as PCI_D3hot), and enable
  *             wakeup events as appropriate.
  *
+ * HIBERNATE   Enter a low power device state appropriate for the hibernation
+ *             state (eg. ACPI S4) and enable wakeup events as appropriate.
+ *
  * FREEZE      Quiesce operations so that a consistent image can be saved;
  *             but do NOT otherwise enter a low power device state, and do
  *             NOT emit system wakeup events.
@@ -166,18 +169,23 @@ typedef struct pm_message {
 #define PM_EVENT_ON 0
 #define PM_EVENT_FREEZE 1
 #define PM_EVENT_SUSPEND 2
-#define PM_EVENT_PRETHAW 3
+#define PM_EVENT_HIBERNATE 4
+#define PM_EVENT_PRETHAW 8
+
+#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
 
 #define PMSG_FREEZE    ((struct pm_message){ .event = PM_EVENT_FREEZE, })
 #define PMSG_PRETHAW   ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
 #define PMSG_SUSPEND   ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
+#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
 #define PMSG_ON                ((struct pm_message){ .event = PM_EVENT_ON, })
 
 struct dev_pm_info {
        pm_message_t            power_state;
        unsigned                can_wakeup:1;
-#ifdef CONFIG_PM_SLEEP
        unsigned                should_wakeup:1;
+       bool                    sleeping:1;     /* Owned by the PM core */
+#ifdef CONFIG_PM_SLEEP
        struct list_head        entry;
 #endif
 };
@@ -190,11 +198,6 @@ extern void device_resume(void);
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
-#define device_set_wakeup_enable(dev,val) \
-       ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
-       (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
 extern void __suspend_report_result(const char *function, void *fn, int ret);
 
 #define suspend_report_result(fn, ret)                                 \
@@ -202,20 +205,6 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
                __suspend_report_result(__FUNCTION__, fn, ret);         \
        } while (0)
 
-/*
- * Platform hook to activate device wakeup capability, if that's not already
- * handled by enable_irq_wake() etc.
- * Returns zero on success, else negative errno
- */
-extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
-       if (platform_enable_wakeup)
-               return (*platform_enable_wakeup)(dev, is_on);
-       return 0;
-}
-
 #else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
@@ -223,28 +212,18 @@ static inline int device_suspend(pm_message_t state)
        return 0;
 }
 
-#define device_set_wakeup_enable(dev,val)      do{}while(0)
-#define device_may_wakeup(dev)                 (0)
-
-#define suspend_report_result(fn, ret) do { } while (0)
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
-       return 0;
-}
+#define suspend_report_result(fn, ret)         do {} while (0)
 
 #endif /* !CONFIG_PM_SLEEP */
 
-/* changes to device_may_wakeup take effect on the next pm state change.
- * by default, devices should wakeup if they can.
+/*
+ * Global Power Management flags
+ * Used to keep APM and ACPI from both being active
  */
-#define device_can_wakeup(dev) \
-       ((dev)->power.can_wakeup)
-#define device_init_wakeup(dev,val) \
-       do { \
-               device_can_wakeup(dev) = !!(val); \
-               device_set_wakeup_enable(dev,val); \
-       } while(0)
+extern unsigned int    pm_flags;
+
+#define PM_APM 1
+#define PM_ACPI        2
 
 #endif /* __KERNEL__ */